COCI '10 Contest 1 #3 Sretan

View as PDF

Submit solution


Points: 7
Time limit: 1.0s
Memory limit: 32M

Problem type

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 Specification

The first and only line of input contains a positive integer K (1K109).

Output Specification

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

Sample Input 1

Copy
1

Sample Output 1

Copy
4

Sample Input 2

Copy
2

Sample Output 2

Copy
7

Sample Input 3

Copy
3

Sample Output 3

Copy
44

Comments

There are no comments at the moment.