Palindometer#1380

Palindometer

1 second
64 megabytes
Very easy

While driving, John looked at his odometer and saw . He was pleased. But just one mile later, the odometer showed , and John was even more excited! John loves palindromes—numbers that read the same forwards and backwards. For any given odometer reading, determine the minimum number of miles John must drive before the odometer shows a palindrome. Every digit on the odometer is significant to John. For example, if the odometer reads , this is not considered a palindrome.

Input

There are several test cases, each consisting of a single line with the odometer reading. Each reading will contain between and digits. The odometer has as many digits as the length of the input line—if the input is , the odometer has digits. There are no spaces in the input, and no blank lines between test cases.

The last line contains a single .

Output

For each test case, output the minimum number of miles John must drive until the odometer reading becomes a palindrome. This may be if the number is already a palindrome. Output each integer on its own line.

Examples

Example 1

Loading
Loading