~/algor $ cat problems/while-eng-yaqin-palindrom
Nearest palindrome
Easy
1000 ms
64 MB
33%
A number that reads the same from left to right and from right to left is called a palindrome (for example, 7, 44, 12321). An integer n is given. Find the smallest palindrome not less than n.
Input
One integer n.
Output
One integer — the smallest palindrome equal to or greater than n.
Note
1 ≤ n ≤ 1 000 000
Examples
Input #1
123
Output #1
131
Input #2
7
Output #2
7