#P6445. [COCI 2010/2011 #1] SRETAN

[COCI 2010/2011 #1] SRETAN

Description

It is known that 44 and 77 are lucky digits, and other digits are not lucky digits. If an integer contains only lucky digits in its decimal representation, then this integer is lucky. You need to find the kk-th lucky positive integer.

Input Format

The input contains one line.

One line with one integer kk, with the meaning as described above.

Output Format

The output contains one line.

One line with one integer, which is the answer.

1
4
2
7
3
44

Hint

Explanation for Sample Input/Output 1

Because we are looking for positive integers, the first one must be the number 44.


Constraints

For 100%100\% of the testdata, 1k1091 \leq k \leq 10^9.


Note

This problem is translated from COCI2010-2011 CONTEST #1 T3 SRETAN.

Translated by ChatGPT 5