4 and 7

Time limit1sMemory limit128 MB

Problem

Changyoung likes positive integers whose decimal representation uses only the digits 4 and 7.

List all numbers Changyoung likes in increasing order. Print the K-th number in that list.

Input

The first line contains an integer K.

  • 1 <= K <= 10^9

Output

Print the K-th smallest number among the numbers Changyoung likes.