P24786 [AtCoder] Palindromic Number
普及
题目描述

Problem Statement

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 Input 1

46

Sample Output 1

363

The 46th smallest palindrome number is 363.

Sample Input 2

1

Sample Output 2

0

Sample Input 3

1000000000000000000

Sample Output 3

90000000000000000000000000000000009

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
46
样例输出
363