p01601 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
```python
n = int(input())

s = list(range(10))
for i in range(1, 100):
    t = str(i)
    s.append(t+t[::-1])
    for j in range(10):
        s.append(t+str(j)+t[::-1])

s = list(map(int, s))
s.sort()
if n in s:
    print(n)
else:
    if n < s[0]:
        print(s[0])
    elif n > s[-1]:
        print(s[-1])
    else:
        res = 0
        diff = 1e9
        for d in s:
            if diff > abs(d-n):
                diff = abs(d-n)
                res = d

        print(res)


```