ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

USU Junior Contest October'2001

About     Problems     Submit solution     Judge status     Standings
Contest is over

H. Salary

Time limit: 1.0 second
Memory limit: 64 MB
All employees of SKB Kontur like to get their salaries. Often and in large quantities. But the company management is of a bit different opinion and pays out strictly once a month. After some consultations the employees decided that if one of the parameters (frequency of payment) was fixed it was possible to change the second parameter (amount of the money paid out). They contrived the following scheme. A group of employees who proudly call themselves mathematics and mechanics faculty graduates visits the management and using their mathematical authority claims that the computers in the company's accounts department will work more efficiently if salaries of all the employees take the form of palindromes. As you know, a numerical palindrome is a number that does not change when you read it from right to left. For example, 12344544321 is a palindrome and 12345543210 is not. Of course, the management had to agree with this proposal, but upon one condition: each employee had to re-count his or her salary so that the salary took the form of the least possible palindrome that is greater than or equal to the original salary. You are asked to help the employees of SKB Kontur.

Input

consists of one string containing the original salary of an employee. The string is not longer than 2001 symbols.

Output

should consist of one string containing the new salary calculated according to the above rules.

Sample

inputoutput
12341321
12344321
Problem Author: Leonid Volkov, Oleg Kats
Problem Source: USU Open Collegiate Programming Contest October'2001 Junior Session
To submit the solution for this problem go to the Problem set: 1123. Salary