AtCoder Regular Contest 144
A
Digit Sum of 2x
AtCoder
⌀ 0
原题
←B →
翻译中…

Problem Statement

翻译中…

For a positive integer $x$, let $f(x)$ be the sum of its digit. For example, $f(144) = 1+4+4 = 9$ and $f(1)=1$.

翻译中…

You are given a positive integer $N$. Find the following positive integers $M$ and $x$:

翻译中…
  • The maximum positive integer $M$ for which there exists a positive integer $x$ such that $f(x)=N$ and $f(2x)=M$.
  • The minimum positive integer $x$ such that $f(x)=N$ and $f(2x)=M$ for the $M$ above.
翻译中…

Constraints

翻译中…
  • $1\leq N\leq 10^5$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print $M$ in the first line and $x$ in the second line.

翻译中…

样例

Input #1
3
Output #1
6
3
We can prove that whenever $f(x)=3$, $f(2x) = 6$. Thus, $M=6$. The minimum positive integer $x$ such that $f(x)=3$ and $f(2x)=6$ is $x=3$. These $M$ and $x$ should be printed.
Input #2
6
Output #2
12
24
Input #3
100
Output #3
200
4444444444444444444444444
题目信息
题号
arc144_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。