Hide

Problem D
Inheritance

The King of Life, the Universe and Everything is nearing the end of his reign. He has started planning for his eventual demise by getting a bunch of kids, hoping one of them will take over after him.

The king has a huge fortune of $P$ suns (the currency of the Universe). He wants to evenly split the fortune among all his kids. However, he also loves the number $42$. So much, in fact, that he wants the number of kids to consist only of the digits $2$ and $4$.

Of course, this will put some constraints on the number of kids he gets. Given $P$, determine all amounts of kids the king can get and be able to split his fortune evenly between them in this manner.

Input

The first and only line contains the integer $P$ ($1 \le P \le 10^{18}$).

Output

Output all the number of kids the king can get in ascending order, one per line.

Explanation of sample 1

In the first example, if the king gets $2$ kids, each of them gets $357$ suns. If he instead gets $42$ kids, each of them gets $17$ suns. There is no other amount of kids he could get.

Sample Input 1 Sample Output 1
714
2
42
Sample Input 2 Sample Output 2
424242424242424242
2
42
222
424242
222222222
424242424242424242

Please log in to submit a solution to this problem

Log in