Problem10919--ABC363 - D - Palindromic Number

10919: ABC363 - D - Palindromic Number

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

A non-negative integer $X$ is called a palindrome number if its decimal representation (without leading zeros) is a palindrome.  
For example, $363$, $12344321$, and $0$ are all palindrome numbers.

Find the $N$-th smallest palindrome number.

Input

The input is given from Standard Input in the following format:

```
$N$
```

Output

Print the $N$-th smallest palindrome number.

Constraints

-   $1 \leq N \leq 10^{18}$
-   $N$ is an integer.

Sample 1 Input

46

Sample 1 Output

363
The 46th smallest palindrome number is $363$.

Sample 2 Input

1

Sample 2 Output

0

Sample 3 Input

1000000000000000000

Sample 3 Output

90000000000000000000000000000000009

Source/Category