Under construction

Still being built. Things may change

Maja

Time limit2sMemory limit512 MB

Summary
Maja makes exactly K moves on a grid, starting and ending at the hive, to maximize flowers pollinated, where each cell regrows its flowers after she leaves.
Level

Medium6 of 10

Topics
Matrix, Dynamic programming, Graph
Solved
No attempts yet

Problem

Maja the Bee pollinates flowers in a magical meadow. The meadow is an NN by MM matrix, and the cell in row ii and column jj has Ci,jC_{i,j} unpollinated flowers.

Maja starts from her hive at row AA, column BB. She makes several moves, visits some cells of the meadow, and returns to the hive. From each cell she can move to an adjacent cell: left, right, up, or down. She never leaves the meadow. Each time she flies over a cell, she pollinates all unpollinated flowers on it. The meadow is magical, though. As soon as Maja leaves cell (i,j)(i, j), every pollinated flower there disappears, and Ci,jC_{i,j} new unpollinated flowers grow on that cell.

Maja cannot fly forever. After KK steps she gets tired and happily tells her adventure to her bee friends. What is the maximum number of flowers Maja can pollinate if she makes exactly KK steps and ends back at the hive?

Input

The first line contains positive integers NN, MM, AA, BB, and KK (2≤N,M≤1002 \le N, M \le 100, 1≤A≤N1 \le A \le N, 1≤B≤M1 \le B \le M, 2≤K≤1092 \le K \le 10^9). KK is always even. The next NN lines each contain MM integers, the flower counts Ci,jC_{i,j} (0≤Ci,j≤1090 \le C_{i,j} \le 10^9). The hive cell has no flowers.

Output

Print the number described in the problem statement.

Hint

In the first sample, Maja starts at (1,1)(1, 1), flies to the cell below, pollinates 2 flowers there, and returns to the hive. In the second sample, Maja starts at (1,1)(1, 1) and moves right, down, up, then left. She visits (1,2)(1, 2) twice, and each visit pollinates 5 flowers there.

Examples3

  1. Example 1

    Input
    2 2 1 1 2
    0 1
    2 10
    
    Expected output
    2
    
  2. Example 2

    Input
    2 2 1 1 4
    0 5
    5 10
    
    Expected output
    20
    
  3. Example 3

    Input
    3 3 2 2 6
    5 1 0
    1 0 3
    1 3 3
    
    Expected output
    15