Ones and sevens#7509

Ones and sevens

1 second
128 megabytes
Easy

Find the -th number of the increasing sequence of positive integers:

1,\ 7,\ 11,\ 17,\ 71,\ 77,\ 111,\ 117,\ 171,\ 177,\ 711,\ 717,\ldots

Input

One positive integer (1 \leq n \leq 10^7).

Output

Print the -th number of the given sequence.

Examples

Example 1

Loading
Loading