#K50122. Next Palindrome Number

    ID: 28795 Type: Default 1000ms 256MiB

Next Palindrome Number

Next Palindrome Number

You are given an integer \(n\). Your task is to find the smallest palindrome number which is strictly greater than \(n\). A palindrome is a number that reads the same backward as forward, such as 121 or 1331.

For example, if \(n = 123\), the next palindrome is \(131\).

Note: The answer for a given input \(n\) is guaranteed to exist. Your solution should compute the answer efficiently even if \(n\) is large.

inputFormat

The input consists of a single line containing one integer \(n\) (\(0 \leq n \leq 10^8\)). This integer is provided via standard input.

outputFormat

Output a single integer which is the smallest palindrome greater than the given integer \(n\). The output should be printed to standard output.

## sample
1
2