#C245. Next Palindrome

    ID: 45767 Type: Default 1000ms 256MiB

Next Palindrome

Next Palindrome

Given a non-negative integer n, your task is to compute the smallest palindrome greater than n. A number is said to be a palindrome if it reads the same backward as forward. In other words, find the smallest integer m such that m > n and m is a palindrome.

Recall that a number m is a palindrome if it satisfies the equation: \( m = m^R \), where \( m^R \) denotes the reverse of the number m.

inputFormat

The input consists of a single integer n provided via standard input.

Constraints: 0 \( \le n \le 10^{12} \) (for practical purposes).

outputFormat

Output the smallest palindrome strictly greater than the given integer n. The result should be printed to standard output.

## sample
123
131