#P4346. ASCII Art Addition

    ID: 17592 Type: Default 1000ms 256MiB

ASCII Art Addition

ASCII Art Addition

An ASCII art is a 7×N matrix of characters, where each character is either a dot '.' or a lowercase letter 'x'. Each digit (0-9) and the plus sign '+' is represented as a 7×5 matrix as defined below:

  • 0:
    xxxxx
    x...x
    x...x
    x...x
    x...x
    x...x
    xxxxx
        
  • 1:
    ....x
    ....x
    ....x
    ....x
    ....x
    ....x
    ....x
        
  • 2:
    xxxxx
    ....x
    ....x
    xxxxx
    x....
    x....
    xxxxx
        
  • 3:
    xxxxx
    ....x
    ....x
    xxxxx
    ....x
    ....x
    xxxxx
        
  • 4:
    x...x
    x...x
    x...x
    xxxxx
    ....x
    ....x
    ....x
        
  • 5:
    xxxxx
    x....
    x....
    xxxxx
    ....x
    ....x
    xxxxx
        
  • 6:
    xxxxx
    x....
    x....
    xxxxx
    x...x
    x...x
    xxxxx
        
  • 7:
    xxxxx
    ....x
    ....x
    ....x
    ....x
    ....x
    ....x
        
  • 8:
    xxxxx
    x...x
    x...x
    xxxxx
    x...x
    x...x
    xxxxx
        
  • 9:
    xxxxx
    x...x
    x...x
    xxxxx
    ....x
    ....x
    xxxxx
        
  • +:
    .....
    ..x..
    ..x..
    xxxxx
    ..x..
    ..x..
    .....
        

The ASCII art of an expression of the form \(a+b\) is obtained by converting each character (digits and the plus sign) to its corresponding 7×5 matrix and concatenating them with a single column of dots (i.e. a column with 7 dots) between consecutive matrices.

Your task is to read an ASCII art representing an expression \(a+b\), compute the sum \(a+b\), and output the result in the same ASCII art format.

All formulas use LaTeX format. For example, the addition is \(a+b\) and the result for an input representing \(1+2\) should be the ASCII art corresponding to \(3\).

inputFormat

The input consists of 7 lines. Each line is a string of characters (only '.' and 'x') representing a row of the ASCII art of the expression.

The total number of columns is \(6n-1\), where \(n\) is the number of 7×5 matrices (each corresponding to a digit or a plus sign) in the expression.

outputFormat

Output the ASCII art of the addition result. The result should be represented using the same 7×5 matrices for each digit as given above and concatenated with a single column of dots between matrices.

sample

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

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

</p>