#K91112. Next Palindromic Number

    ID: 37904 Type: Default 1000ms 256MiB

Next Palindromic Number

Next Palindromic Number

You are given a non-negative integer \( n \). Your task is to find and output the smallest palindromic number that is strictly greater than \( n \). A palindromic number is a number that remains the same when its digits are reversed.

For example, given \( n = 123 \), the output should be \( 131 \), as it is the first number greater than \( 123 \) that reads the same backwards and forwards.

The formula for checking palindromicity can be expressed as:

\[ \text{isPalindrome}(x) = \left\{ \begin{array}{ll} \text{true} & if \; x = reverse(x) \\ \text{false} & otherwise \end{array} \right. \]

Note: There is no upper bound on \( n \); make sure your solution is efficient enough to handle large inputs.

inputFormat

The input consists of a single line containing a non-negative integer \( n \).

The input is provided via stdin.

outputFormat

Output a single integer representing the smallest palindromic number that is strictly greater than \( n \).

The output should be sent to stdout without any extra characters or spaces.

## sample
123
131