Limits 1s, 1.0 GB

Welcome to CSEmpur once again!

It has been observed that a good number of inhabitants like palindromic numbers. As all of them know, a palindromic number is a number (in some base b) that is the same when written forwards or backwards, i.e., of the form a1 a2 ... a2 a1.

The number system they use is the 10-based number system, with symbols '0', '1', ..., '8', '9', as usual.

Good queen Alysanne of House Targaryen wants to give her loyal subjects a program. One may tell the program a number, n. The program will produce the nth palindromic number written in CSEmpur number system.

Obviously, the queen tells you, the grandmaester, to solve the problem. From your training in the Citadel, you know the first palindromic number is '0', the second is '1', and you can build up on that.

Input

The input will consist of a single positive number, n, the number the program gets as an input. The number will be less than 536870910.

Output

It is your job to print the nth palindromic number in CSEmpuric number system.

Samples

InputOutput
536006334
43600633433600634
InputOutput
7
6
InputOutput
20
101
InputOutput
21
111
InputOutput
112
1221
InputOutput
113
1331

Submit

Login to submit.

Statistics

85% Solution Ratio
Rashid.657145Earliest, Feb '20
Rashid.657145Fastest, 0.0s
Rashid.657145Lightest, 0 B
hredhayxzShortest, 404B
Toph uses cookies. By continuing you agree to our Cookie Policy.