#B2104. Matrix Addition

    ID: 11186 Type: Default 1000ms 256MiB

Matrix Addition

Matrix Addition

Given two matrices \(A\) and \(B\) each of size \(n \times m\), compute their sum \(A+B\). The addition operation is defined element-wise as:

\[ (A+B)_{i,j} = A_{i,j} + B_{i,j}, \quad \text{for } 1 \le i \le n, \; 1 \le j \le m. \]

Please refer to the sample for more details.

inputFormat

The first line contains two integers \(n\) and \(m\) (number of rows and columns respectively). The following \(n\) lines each contain \(m\) space-separated integers representing the matrix \(A\). After that, there are another \(n\) lines each containing \(m\) space-separated integers representing the matrix \(B\).

outputFormat

Output the resulting matrix \(A+B\) in the form of \(n\) lines, where each line contains \(m\) space-separated integers.

sample

2 2
1 2
3 4
2 2
2 2
3 4

5 6

</p>