4404 - [Neerc2015]Binary vs Decimal

一个数A,如果它转成二进制后B。A是B的后缀,这个数就是我们所要的。 现在给出数字N,求第N个这样的数(1 ≤ n ≤ 10000)

Input

Output

Examples

Input

2

Output

10
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题