e-olymp
Competitions

December 4 - BMTK Programming School, High League

Partial matrix sum

The matrix of integers aij is given, where 1in, 1jm. For all i, j find prb683

Input

The first line contains the matrix size n, m (1n, m1000). Each of the next n lines contains m integers aij (1aij1000).

Output

Print n rows each containing m numbers Sij.

Time limit 1 seconds
Memory limit 122.17 MiB
Input example #1
3 5
1 2 3 4 5
5 4 3 2 1
2 3 1 5 4
Output example #1
1 3 6 10 15
6 12 18 24 30
8 17 24 35 45
Author В.Гольдштейн
Source Зимние сборы в Харькове 2010 День 2