Sum of subarray elements
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given a two-dimensional array of size n * m, your task is to find the sum of the elements within a specified subarray.
Input
The first line contains two integers, n and m (1 ≤ n, m ≤ 100), representing the number of rows and columns, respectively. This is followed by n lines, each containing m integers, which are the elements of the array.
The final line provides four integers: , , , ( ≤ , ≤ ). These numbers specify the row and column indices of the top-left and bottom-right corners of the subarray. All array elements are integers with absolute values not exceeding 100. Note that the indexing starts from 1.
Output
Print the sum of the elements within the specified subarray.
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 55%