LearnPy Hub
← Lists problems
Hard

Row and Column Totals

Read r and c, then r rows of c integers. Print each row's sum on one line, then each column's sum on the next.

Input

r c, then r rows.

Output

Two lines.

Sample 1

Input
2 3
1 2 3
4 5 6
Output
6 15
5 7 9

Sample 2

Input
1 1
7
Output
7
7
solution.py
Output appears here
Row and Column Totals · Python practice problem · LearnPy Hub