#K79897. Taco Column Sums

    ID: 35410 Type: Default 1000ms 256MiB

Taco Column Sums

Taco Column Sums

You are given a matrix A of dimensions \(n \times m\). Your task is to compute the sum of the elements in each column of the matrix and output the result as a single line of \(m\) integers.

If the matrix is empty (i.e. no rows or the rows have no columns), output an empty line.

Example:

Input:
3 3
1 2 3
4 5 6
7 8 9

Output: 12 15 18

</p>

Note: In mathematical notation, for a given matrix \(A\) with elements \(a_{ij}\), the sum of the \(j\)-th column is defined as:

[ S_j = \sum_{i=1}^{n} a_{ij} ]

inputFormat

The input is given via standard input (stdin) and has the following format:

  • The first line contains two integers \(n\) and \(m\), representing the number of rows and the number of columns respectively. (\(0 \leq n, m \leq 100\))
  • If \(n > 0\) and \(m > 0\), then the next \(n\) lines each contain \(m\) integers separated by spaces, representing the rows of the matrix.
  • If either \(n==0\) or \(m==0\), the matrix is considered empty.

outputFormat

Output a single line to standard output (stdout) containing \(m\) integers separated by spaces, where each integer is the sum of the corresponding column of the matrix. If the matrix is empty, output an empty line.

## sample
3 3
1 2 3
4 5 6
7 8 9
12 15 18