Time Limit:1000ms Memory Limit:65536KB

Description

When the cildren's day comes, the God-Like Cow(GLC) wants to celebrate the festival.
So he buys many cards with digit '1' or '6' and gives them to girls in memory of "6.1".
But the girls join the cards together to form a number.
What the k-th(1-based) large number?

Input

Mutiple test cases.
Each line is a integer k(1<=k<=10000).

Output

For each test case, output the answer in a single line.

Sample Input

1
2
4

Sample Output

1
6
11

Hint

1 6 9 11 16 19 61 66 69 91 96 99

Author

baihacker

Source