408518: GYM103176 K Kth number in Byteland

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Kth number in Bytelandtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

There are thousands of written languages in the world. Some of them are read from left to right, such as English. Some of them are read from right to left, such as Arabic.

In Byteland, programmers come from many different countries. To avoid ambiguity, the mayor of Byteland decided to publish a new written language and also a new number system that remains the same regardless if it is read from left to right or right to left. Moreover, since the mayor loves odd number, he wants the numbers in the new number system consist of odd number of digits. Therefore, the mayor decided that the $$$k^{th}$$$ number in the new number system shall be the $$$k^{th}$$$ smallest non-negative number in the decimal number system that consists of an odd number of digits and remains unchanged when it is read from either direction.

For example, the $$$1^{st}$$$ number in the new number system is $$$0$$$, and the $$$24^{th}$$$ number is $$$232$$$.

As you are a newcomer in Byteland and you are trying to get familiar with the number system, you want to know the $$$k^{th}$$$ number in the Byteland!

Input

The input contains only one integer, $$$k$$$ ($$$1 \le k \le 10^{9}$$$).

Output

Output one integer, the $$$k^{th}$$$ number in the new number system in Byteland.

ExamplesInput
1
Output
0
Input
24
Output
232

加入题单

算法标签: