#P8078. tt

    ID: 7171 传统题 1000ms 32MiB 尝试: 2 已通过: 1 难度: 4 上传者: 标签>CF1400字符串贪心模拟构造数学2015高精度

tt

Description

An integer is considered handsome if every two of its consecutive digits are of different parity. For a given integer NN, what is its closest handsome number?

Please note: Numbers consisting of only one digit are handsome numbers. The distance of two numbers is the absolute value of their difference.

Input

The first and only line of input contains the positive integer NN that consists of at most thousand digits and is not handsome.

Output

The first and only line of output must contain the required closest handsome number. If two closest numbers exist, output the smaller number first and then the larger one and separate them by a single space.

13
12 14
5801001
5810101

Scoring

In all test cases, 1n1010001 \leq n \leq 10^{1000}.