Again the sum (of functions)
Given a field divided into ( n \times m ) squares, where rows are numbered from 1 to ( n ) (top to bottom) and columns from 1 to ( m ) (left to right), each cell contains a specific number.
Your task is to calculate the sum of all these numbers.
Interaction
You need to implement the following function:
integer solve(integer n, integer m, integer g)
n
andm
are the dimensions of the field.g
is the block number.The function should return a single integer, which is the sum of all numbers in the field.
To achieve this, you should use the function:
integer getValue(integer x, integer y)
x
(1 ≤ x ≤ n) is the row number.y
(1 ≤ y ≤ m) is the column number.This function returns the number located in the cell at position (x, y).
Input Format
The first line contains three integers: ( n ), ( m ), and ( g ) (1 ≤ ( n, m ) ≤ 100, 1 ≤ ( g ) ≤ 2), representing the dimensions of the field.
Each of the following ( n ) lines contains ( m ) integers: ( a[i1], a[i2], \ldots, a[im] ), representing the numbers in the field.
(1 ≤ ( a[ij] ) ≤ ( 10^9 ))—the numbers in the field.
Output Format
Output a single integer, which is the sum of all numbers in the field.
Blocks:
(30 points) ( n \leq 1 );
(70 points) no additional constraints.