#D3942. Palindromic Number
Palindromic Number
Palindromic Number
Palindrome
Problem Statement
Find the number of palindromes closest to the integer n.
Note that the non-negative integer x is the number of palindromes, which means that the character string in which x is expressed in decimal notation and the character string in which it is inverted are equal. For example, 0,7,33,10301 is the number of palindromes, and 32,90,1010 is not the number of palindromes.
Constraints
- 1 ≤ n ≤ 10 ^ 4
Input
Input follows the following format. All given numbers are integers.
n
Output
Output the number of palindromes closest to n. If there are multiple such numbers, output the smallest one.
Examples
Input
13
Output
11
Input
7447
Output
7447
Input
106
Output
101
inputFormat
Input
Input follows the following format. All given numbers are integers.
n
outputFormat
Output
Output the number of palindromes closest to n. If there are multiple such numbers, output the smallest one.
Examples
Input
13
Output
11
Input
7447
Output
7447
Input
106
Output
101
样例
13
11