cho.sh
Notes
Loading...

Next Palindrome Number

Time limit

2s

Memory limit

128 MB

Problem

A palindrome number is a positive integer that reads the same from left to right and from right to left. 101, 4, and 6666 are palindrome numbers, while 10, 564, and 15452 are not.

Given a positive integer N, find the smallest palindrome number that is greater than N.

Input

The first line contains a positive integer N. N has at most 50 digits, and its first digit is not 0.

Output

Print the smallest palindrome number greater than N.