Almost Bobo Number

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

A positive integer is called a bobo number if its decimal representation can be obtained by concatenating two copies of the same integer. For example, 1234123412341234 and 32323232 are bobo numbers, while 12343211234321 and 13221322 are not.

A positive integer is called an almost bobo number if, after merging all the consecutive equal digits, the resulting number is a bobo number. For example, 1112223112233\underbrace{111}\underbrace{222}\underbrace{3}\underbrace{11}\underbrace{22}\underbrace{33} becomes 123123123123 after merging all the consecutive equal digits, and thus is an almost bobo number.

Bobo has a very large number nn, and he would like to know the largest almomst bobo number less than nn.

입력

The input contains zero or more test cases, and is terminated by end-of-file. For each test case:

The first line contains an integer nn without leading zeros (1n105,000,0001 \leq n \leq 10^{5\\,000\\,000}).

It is guaranteed that the total length of the decimal representations of all nn in the input does not exceed 5,000,0005\\,000\\,000.

출력

For each test case, output an integer without leading zeros denoting the largest almomst bobo number strictly less than nn. If there is no such integer, output 1-1 instead.