Gas Station Numbers

Time limit1sMemory limit128 MB

Problem

Many gas stations display fuel prices with plastic digit tiles on an illuminated sign. When a particular digit runs short, the attendant can turn another tile upside down and use it in its place.

When a tile is turned upside down, it looks like this:

  • 6 becomes 9, and 9 becomes 6.
  • 0, 1, and 8 look like themselves.
  • 2 becomes 5, and 5 becomes 2 (close enough for a gas station).
  • 3, 4, and 7 do not form a valid digit when turned upside down.

Because prices have risen sharply, one gas station has used all of its available tiles to display the current price. Fortunately, a shortage of tiles need not stop the attendant from raising the price: she can rearrange the tiles she already has, turning some of them upside down according to the rules above.

Given the current price, compute the next highest price that can be displayed using exactly the same tiles.

Input

The input consists of several lines. Each line contains between 2 and 30 digits and a single decimal point placed immediately before the last digit, so there is always exactly one digit after the decimal point. There are no useless leading zeroes; that is, a leading zero appears only when the price is less than 1.

A line containing a decimal point alone (.) terminates the input.

Output

For each price, print on its own line the next highest price that can be displayed using the same tiles and the same format rules. If the price cannot be raised, print The price cannot be raised.