URI Online Judge | 3100

The Lucky Digits

By Ygor Ribeiro, IFSULDEMINAS BR Brazil

Timelimit: 1

Ribeiro is passionate about everything that involves numbers. It has 3 lucky digits, they are {3, 5, 7}. In his spare time, he writes a sequence of these digits and wants to know what the smallest number can be formed from that written sequence. But to find such a number is not so simple, there is a single rule.

Rule: You can only move a number to the left or right if and only if the absolute difference between it and its neighbor is 2.

Don't worry about the amount of movement you have to do, the main objective is to find the smallest number within this rule.

Example: Number 75337. Applying your rule to such a number, we can form: 73537, 73357, 73375 and so on. But the smallest is 57337.

Your task here is very simple, given a sequence of the digits of Ribeiro's luck, inform what is the smallest number that can be formed from it.

Input

The input contains an integer N (3 <= N <= 10 ^ 10000), with only the digits 3, 5 and 7.

Output

A saída contém o menor número de acordo com a regra do problema.

Input Samples Output Samples

75337

57337

5357535777

3555573777

3333357

3333357