The Lucky Base
Limits: 2 sec., 256 MiB
You are given an integer \(n\). Please, find the number of numerical systems in which \(n\) is a lucky number.
The number is considered to be lucky if it consists of only digits \(4\) and \(7\). For example 4, 47 and 444747 are lucky numbers nut 457, 53, 115 are not.
Input
The only line contains single integer \(n\) in base 10.
Output
Print all of the bases of numerical systems in which \(n\) is a lucky number in ascending order in
a single line separated by single spaces. If there is an infinite number
of bases print INFINITY instead. If there is no such bases
print NONE instead.
Constraints
\(1 \le n \le 10^9\)
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 39 | 8 |
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|