A positive integer aa is given. Baron Munchausen claims that he knows such a positive integer nn that if one multiplies nn by aa, the sum of its digits decreases aa times. In other words, S(an)=S(n)/aS(an)=S(n)/a, where S(x)S(x) denotes the sum of digits of the number xx.

Find out if what Baron told can be true.

Input

The only line contains a single integer aa (2≤a≤1032≤a≤103).

Output

If there is no such number nn, print −1−1.

Otherwise print any appropriate positive integer nn. Your number must not consist of more than 5⋅1055⋅105 digits. We can show that under given constraints either there is no answer, or there is an answer no longer than 5⋅1055⋅105 digits.

Examples

Input
2
Output
6
Input
3
Output
6669
Input
10
Output
-1

题解都不懂的大坑

Day8 - E - The very same Munchhausen CodeForces - 1120E的更多相关文章

  1. Day8 - C - Another Problem on Strings CodeForces - 165C

    A string is binary, if it consists only of characters "0" and "1". String v is a ...

  2. Day8 - D - Multiplication Table CodeForces - 448D

    Bizon the Champion isn't just charming, he also is very smart. While some of us were learning the mu ...

  3. Day8 - B - Non-Secret Cypher CodeForces - 190D

    Berland starts to seize the initiative on the war with Flatland. To drive the enemy from their nativ ...

  4. Day8 - A - Points on Line CodeForces - 251A

    Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. N ...

  5. Codeforces Round #539&#542&#543&#545 (Div. 1) 简要题解

    Codeforces Round #539 (Div. 1) A. Sasha and a Bit of Relax description 给一个序列\(a_i\),求有多少长度为偶数的区间\([l ...

  6. [codeforces] 暑期训练之打卡题(一)

    每个标题都做了题目原网址的超链接 Day1<Vanya and Lanterns> 题意: 一条长度为 l 的街道,在这条街道上放置了n个相同的灯,街道一端位置记为0,每个灯的位置在ai处 ...

  7. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  8. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  9. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

随机推荐

  1. git pull 之后怎么找回别覆盖掉的内容

    [半夜吓出冷汗,git这个原理还真得好好学学] 不小心把本地写的东西pull了下,然后,全部覆盖掉了,以为就这样没了. 后面想到有“时光穿梭机”,“历史回滚”,在各大群友的帮助下,终于找回了. git ...

  2. Mybatis笔记一

    课程安排: mybatis和springmvc通过订单商品 案例驱动 第一天:基础知识(重点,内容量多) 对原生态jdbc程序(单独使用jdbc开发)问题总结 mybatis框架原理 (掌握) myb ...

  3. 十一 Spring的AOP开发的相关术语

    SpringAOP简介: AOP思想最早是由AOP联盟组织提出的.Spring使用这种思想最好的框架. Spring的AOP有自己实现的方式,但是非常繁琐.AspectJ是一个AOP框架,Spring ...

  4. kali apt update 错误——下列签名无效: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository

    这是因为key过期了 wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add apt update

  5. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 排版:列表

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. MFC中写入汉语到文本文档

    目录 1.首先要引入头文件 2.在打开文件后,要进行设置,然后在关闭文档时,进行设置的后处理 3.输出的文本 1.首先要引入头文件 #include <locale> 2.在打开文件后,要 ...

  7. exp之shellcode的理解

    原题请见 https://www.jarvisoj.com/challenges from pwn import * io = remote("pwn2.jarvisoj.com" ...

  8. Android游戏开发学习(5)--实现Button悬浮于与SurfaceView之上

    原文:http://daikainan.iteye.com/blog/1407355 实现Button悬浮于与SurfaceView之上实现 先看效果: 注意:你实现的SurfaceView和andr ...

  9. 使用mvn deploy命令将本地jar包上传到maven私服

    记录一下,以后少走弯路 前提:已经搭建好nexus maven私服,地址192.168.110.240:9091 在maven的setting.xml中找到<mirrors></mi ...

  10. VUE引入模块之import xxx from 'xxx' 和 import {xxx} from 'xxx'的区别

    import FunName from ‘../xxx’ export defualt function FunName() { return fetch({ url: '/article/list' ...