Sum of subarray elements#9562

Sum of subarray elements

1 second
128 megabytes
Easy

Given a two-dimensional array of size n \times m, your task is to find the sum of the elements in a specified subarray.

Input

The first line contains two integers, and m~(1 \le n, m \le 100), representing the number of rows and columns, respectively.

The next lines each contain integers representing the elements of the array. The absolute value of each array element does not exceed .

The last line contains four integers: r_1, c_1, r_2, and c_2~(r_1 \le r_2, c_1 \le c_2). These values specify the row and column indices of the top-left and bottom-right corners of the subarray, respectively.

The array is -indexed, meaning that its rows and columns are numbered starting from .

Output

Print the sum of all elements in the specified subarray.

Examples

Example 1

Loading
Loading