Under construction

Still being built. Things may change

Mutint

Time limit1sMemory limit1024 MB

Summary
Given several positive integers ending with a zero, change each number's leftmost largest digit: odd digits become 0, and even digits gain 4 (mod 10).
Level

Easy1 of 10

Topics
Implementation, String
Solved
No attempts yet

Problem

A "Mutint" is an integer M that is changed according to certain criteria, such as in this problem. Given a positive integer, change M according to the following rules.

  1. Find the leftmost largest digit D of M.
  2. If D is odd, change it to a zero.
  3. If D is even, add 4 to that digit. If the sum exceeds 9, change D to the ones digit of the sum.

Input

Several integers, each on one line. The end of input is signaled with a zero on the last line. All integers, except the last integer, are positive.

Output

Print M, according to the rules above. M cannot have leading zeros.

Examples1

  1. Example 1

    Input
    132
    1421
    18234
    923
    0
    
    Expected output
    102
    1821
    12234
    23