Problem list
Log in
#coci00153 · COCI 2010/2011 Contest 1

Sretan

Gold V 1.0 s 32 MB

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.

Example 1

Input
1
Output
4

Example 2

Input
2
Output
7

Example 3

Input
3
Output
44
Source
COCI 2010/2011 Contest 1
Appears in
Not part of a ladder, contest or set yet.
Accepted 1 Submissions 1 Acceptance 100% Solvers 1

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code