Road to top 50 V-N-U-S-E-R-S

Start

2022-01-01 02:00 AKST

Road to top 50 V-N-U-S-E-R-S

End

2022-01-05 06:00 AKST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -141 days 16:31:49

Time elapsed

100:00:00

Time remaining

0:00:00

Problem E
Sretan

Digits $4$ and $7$ are lucky, while all others are unlucky. An integer is lucky if it contains only lucky digits in decimal notation. We would like to know the $K$-th lucky positive integer.

Input

The first and only line of input contains a positive integer $K$ ($1 \le K \le 10^9$).

Output

The first and only line of output must contain the $K$-th lucky positive integer.

Sample Input 1 Sample Output 1
1
4
Sample Input 2 Sample Output 2
2
7
Sample Input 3 Sample Output 3
3
44