Processing math: 100%
Diagonal sum - MarisaOJ: Marisa Online Judge

Diagonal sum

Time limit: 1000 ms
Memory limit: 256 MB

Given a 2D array A with n rows and m columns, and two integers x and y, calculate the sum of the elements on the two diagonals that pass through the element at row x and column y (Ax,y).

Input

  • The first line contains 4 integers n,m,x,y.
  • The next n lines each contain m integers representing the array A.

Output

  • Calculate the sum of the elements lying on the two diagonals that pass through the element at row x and column y (Ax,y).

Constraints

  • 1≤n,m≤100.
  • 1≤x≤n, 1≤y≤m.
  • |Ai,j|≤100.

Example

Input: Input:

3 4 2 2
1 -2 3 2
4 -5 9 0
3 3 2 -2

Output:

4

Note: 1+3+−5+3+2=4

1 -2 3 2

4 -5 9 0

3 3 2 -2