AtCoder Regular Contest 075
F
Mirrored
AtCoder
⌀ 2549
原题
← E→
翻译中…

Problem Statement

翻译中…

For a positive integer $n$, we denote the integer obtained by reversing the decimal notation of $n$ (without leading zeroes) by $rev(n)$. For example, $rev(123) = 321$ and $rev(4000) = 4$.

翻译中…

You are given a positive integer $D$. How many positive integers $N$ satisfy $rev(N) = N + D$?

翻译中…

Constraints

翻译中…
  • $D$ is an integer.
  • $1 ≤ D < 10^9$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

D

翻译中…

Output

翻译中…

Print the number of the positive integers $N$ such that $rev(N) = N + D$.

翻译中…

样例

Input #1
63
Output #1
2
There are two positive integers $N$ such that $rev(N) = N + 63$: $N = 18$ and $29$.
Input #2
75
Output #2
0
There are no positive integers $N$ such that $rev(N) = N + 75$.
Input #3
864197532
Output #3
1920
题目信息
题号
arc075_d
时间限制
2 s
内存限制
256 MB

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