~/algor $ cat problems/matritsa-elementlar-yigindisi
Sum of matrix elements
Easy
1000 ms
128 MB
22%
An integer matrix of size $n \times m$ is given. Compute the sum of all its elements:
$$S = \sum_{i=1}^{n} \sum_{j=1}^{m} a_{i,j}$$
Input
The first line contains two positive integers $n$ and $m$. Each of the next $n$ lines contains $m$ integers $a_{i,j}$.
Output
One integer — the sum of the elements.
Note
$1 \le n, m \le 200$
$-1000 \le a_{i,j} \le 1000$
Examples
Input #1
2 3 1 2 3 4 5 6
Output #1
21
Input #2
1 1 -7
Output #2
-7