Time Limit : sec, Memory Limit : KB
Japanese

回文数

Problem Statement

整数nに最も近い回文数を求めよ.

なお,非負整数xが回文数であるとは,xを十進法で表現した文字列とそれを反転させた文字列が等しいことをいう.
例えば0,7,33,10301などは回文数であり,32,90,1010などは回文数でない.

Input

入力は以下の形式に従う.与えられる数は全て整数である.

n

Constraints

  • 1≦n≦10^4

Output

nに最も近い回文数を出力せよ.
そのような数が複数ある場合は最も小さいものを出力せよ.

Sample Input 1

13

Output for the Sample Input 1

11

13に最も近い回文数は11である.

Sample Input 2

7447

Output for the Sample Input 2

7447

7447は回文数なのでそのまま出力すればよい.

Sample Input 3

106

Output for the Sample Input 3

101

106に最も近い回文数は111と101のふたつあるが,そのうち小さい方の101を出力する.