Under construction

Still being built. Things may change

ASCII Addition

Time limit1sMemory limit512 MB

Summary
Read the 7-row ASCII art of a plus b and print their sum in the same 7 by 5 digit art.
Level

Easy3 of 10

Topics
Implementation, Matrix
Solved
No attempts yet

Problem

Some smartphone apps translate text and even solve equations when you point the camera at them. The task here is much simpler. Add two integers that are drawn as ASCII art.

An ASCII art is a matrix of characters that is exactly 7 rows high. Every character is either a dot (.) or the lowercase letter x.

An expression of the form a+ba + b is given, where aa and bb are positive integers. The expression becomes ASCII art this way. Every character of the expression, meaning each digit of aa and bb together with the + sign, is turned into a 7×57 \times 5 matrix, and consecutive matrices are joined horizontally with one column of dots between them. The matrices for the digits 0 to 9 and for the + sign are the following.

xxxxx  ....x  xxxxx  xxxxx  x...x  xxxxx  xxxxx  xxxxx  xxxxx  xxxxx  .....
x...x  ....x  ....x  ....x  x...x  x....  x....  ....x  x...x  x...x  ..x..
x...x  ....x  ....x  ....x  x...x  x....  x....  ....x  x...x  x...x  ..x..
x...x  ....x  xxxxx  xxxxx  xxxxx  xxxxx  xxxxx  ....x  xxxxx  xxxxx  xxxxx
x...x  ....x  x....  ....x  ....x  ....x  x...x  ....x  x...x  ....x  ..x..
x...x  ....x  x....  ....x  ....x  ....x  x...x  ....x  x...x  ....x  ..x..
xxxxx  ....x  xxxxx  xxxxx  ....x  xxxxx  xxxxx  ....x  xxxxx  xxxxx  .....

Given the ASCII art of an expression of the form a+ba + b, compute the sum and print it as ASCII art in the same format.

Input

The input has exactly 7 lines and holds the ASCII art of an expression of the form a+ba + b. Both aa and bb are positive integers with at most 9 decimal digits and no leading zeros.

Output

Print 7 lines with the ASCII art of the sum. Do not print leading zeros.

Examples1

  1. Example 1

    Input
    ....x.xxxxx.xxxxx.x...x.xxxxx.xxxxx.xxxxx.......xxxxx.xxxxx.xxxxx
    ....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
    ....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
    ....x.xxxxx.xxxxx.xxxxx.xxxxx.xxxxx.....x.xxxxx.xxxxx.xxxxx.x...x
    ....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
    ....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
    ....x.xxxxx.xxxxx.....x.xxxxx.xxxxx.....x.......xxxxx.xxxxx.xxxxx
    
    Expected output
    ....x.xxxxx.xxxxx.xxxxx.x...x.xxxxx.xxxxx
    ....x.....x.....x.x.....x...x.x.........x
    ....x.....x.....x.x.....x...x.x.........x
    ....x.xxxxx.xxxxx.xxxxx.xxxxx.xxxxx.....x
    ....x.x.........x.....x.....x.....x.....x
    ....x.x.........x.....x.....x.....x.....x
    ....x.xxxxx.xxxxx.xxxxx.....x.xxxxx.....x