Define a A x B sum as the sum of all integers in a A x B grid. Given an N x M grid of integers, sum up all of the A x B sums in that grid. You will be given integers N, M, A, B. Then in the following N lines, you will be given M integers.
Sample input:
4 3 3 2
1 2 3
4 5 6
7 8 9
10 11 12
Sample output:
156
Explanation:
The A x B grids in the given grid are the 3 x 2 grids:
Class 2:
Define a A x B sum as the sum of all integers in a A x B grid. Given an N x M grid of integers, sum up all of the A x B sums in that grid. You will be given integers N, M, A, B. Then in the following N lines, you will be given M integers.
Sample input:
4 3 3 2
1 2 3
4 5 6
7 8 9
10 11 12
Sample output:
156
Explanation:
The A x B grids in the given grid are the 3 x 2 grids:
1 2 2 3 4 5 5 6
4 5 5 6 7 8 8 9
7 8 8 9 10 11 11 12
If you sum up all of those numbers, you get 156