Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 2831
Decorated A+B

Time Limit: 2 Seconds      Memory Limit: 65536 KB

It is really amazing to get an "A + B Problem" in a real programming contest, so you'd better get started from this one. But don't hurry, we have to deal with numbers given as bitmap array. The bitmap array of each digit is an 8x8 matrix, picturing the shape of the digit. The internal of the digit will be marked by an 'X', and the background will be spaces, as showed in the following table.

012345 6789+
  XXXX  
 XX  XX 
 XX  XX 
 XX  XX 
 XX  XX 
 XX  XX 
 XX  XX 
  XXXX  
   XX   
 XXXX   
   XX   
   XX   
   XX   
   XX   
   XX   
 XXXXXX 
  XXXX  
 XX  XX 
 XX  XX 
     XX 
    XX  
   XX   
  XX    
 XXXXXX 
  XXXX  
 X   XX 
     XX 
   XXX  
     XX 
     XX 
 X   XX 
  XXXX  
    XX  
   XXX  
   XXX  
  X XX  
 X  XX  
 XXXXXX 
    XX  
  XXXXX 
  XXXXX 
  XX    
  XXXX  
  X  XX 
     XX 
     XX 
 X   XX 
  XXXX  
   XXXX 
  XX    
 XX     
 XXXXX  
 XX  XX 
 XX  XX 
 XX  XX 
  XXXX  
 XXXXXX 
 X   XX 
     XX 
    XX  
    XX  
    XX  
   XX   
   XX   
  XXXX  
 XX  XX 
 XX  XX 
  XXXX  
 XX  XX 
 XX  XX 
 XX  XX 
  XXXX  
  XXXX  
 XX  XX 
 XX  XX 
 XX  XX 
  XXXXX 
     XX 
    XX  
 XXXX   
        
   X    
   X    
   X    
XXXXXXX 
   X    
   X    
   X    
Input

The input file consists of several test cases. The first line of the input will be one integer N (0 < N <= 10), representing the number of test cases. Each test consists of exact 8 (eight) lines, which is the "A + B" problem. The bitmap array will be used to display each digit of A and B. Because the problem author is careless when preparing the input data, extraneous spaces may be (but not necessarily) inserted around each digit, and the trailing spaces at the end of the line may be removed by his (may be "her") editor. However, it is guaranteed that the A and B will be nonnegative integers less than 10000, and if any spaces are inserted around the digit, each line of the input will have the same number of spaces inserted at the same column. A and B will be separated by the "+" character. There will be a blank line between consecutive test cases.

Output

For each test case, output the result of A + B, using the given bitmap array. Please do NOT add any extraneous spaces around the digit, and the trailing spaces should be kept.

Separate two consecutive test cases with a blank line, but Do NOT output an extra blank line after the last one.

Sample Input
1
   XX             XXXXX 
 XXXX      X      XX    
   XX      X      XXXX  
   XX      X      X  XX 
   XX   XXXXXXX      XX 
   XX      X         XX 
   XX      X     X   XX 
 XXXXXX    X      XXXX  
Sample Output
   XXXX 
  XX    
 XX     
 XXXXX  
 XX  XX 
 XX  XX 
 XX  XX 
  XXXX  

Note

Sample input and output are underlined to show the positions of the spaces. They are not the underscore character.


Author: YANG, Chao
Source: Zhejiang University Local Contest 2007, Preliminary
Submit    Status