Matrix Addition

Time limit1sMemory limit128 MB

Summary
Read two N by M integer matrices and print their element-wise sum.
Level

Easy1 of 10

Topics
Matrix, Implementation
Solved
No attempts yet

Problem

You are given two integer matrices A and B, each of size N*M. Write a program that outputs the matrix formed by adding the entries in the same positions of A and B.

Input

The first line contains the matrix dimensions N and M. The next N lines contain matrix A, with M integers on each line. The following N lines contain matrix B, also with M integers on each line.

N and M are positive integers at most 100, and every matrix entry is an integer whose absolute value is at most 100.

Output

Print N lines, the matrix obtained by adding A and B. Each line must contain M entries of one row, separated by spaces.

Examples1

  1. Example 1

    Input
    3 3
    1 1 1
    2 2 2
    0 1 0
    3 3 3
    4 4 4
    5 5 100
    
    Expected output
    4 4 4
    6 6 6
    5 6 100