Problem A
Braille Addition
Languages
en
sv
To save on electricity bills, Lydia has decided to do math without lighting. Without lighting, it is difficult to distinguish regular text, so Lydia plans to switch to Braille. In Braille, each character is written as a grid of $3 \times 2$ dots, where some are raised. In Figure 1, you can see how the ten digits are written in Braille.
![\includegraphics[width=0.75\textwidth ]{braille.png}](/problems/brailleaddition/file/statement/en/img-0001.png)
She now needs your help to verify her calculations. Write a program that finds the sum of two numbers in Braille form.
Input
The first line contains an integer $N$ ($1 \leq N \leq 9$), the number of digits in the first number.
The following three lines contain $N$ Braille digits representing the first number.
The next line contains an integer $M$ ($1 \leq M \leq 9$), the number of digits in the second number.
The following three lines contain $M$ Braille digits representing the second number.
The Braille digits are given as a matrix of $3 \times 2$ characters, where an asterisk (’*’) indicates a raised dot and a period (’.’) indicates a dot that is not raised.
The digits are given in the same order as a regular decimal number, so that the last digit corresponds to the unit digit of the number. The numbers have no leading zeros, except in the case the number is $0$.
Output
Print sum of the two numbers in braille.
Scoring
Your solution will be tested on a set of test groups, each worth a number of points. Each test group contains a set of test cases. To get the points for a test group you need to solve all test cases in the test group.
Group |
Points |
Constraints |
$1$ |
$31$ |
Only the braille digit $1$ appears in the input. |
$2$ |
$69$ |
No additional constraints. |
Explanation of samples
The first number consists of the Braille digits $1$, $6$, and $0$, which together form the number $160$. The second number consists of the Braille digits $1$ and $6$, which together form the number $16$. The sum is $160 + 16 = 176$.
Sample Input 1 | Sample Output 1 |
---|---|
3 *. ** .* .. *. ** .. .. .. 2 *. ** .. *. .. .. |
*. ** ** .. ** *. .. .. .. |
Sample Input 2 | Sample Output 2 |
---|---|
1 ** ** .. 1 ** .. .. |
*. .* .. ** .. .. |
Sample Input 3 | Sample Output 3 |
---|---|
1 .* ** .. 1 .* ** .. |
.* ** .. |