The Lazy Cow

No attempts yetTime limit1sMemory limit128 MB

Problem

On a hot summer day, Bessie the cow feels lazy. She wants to pick a starting cell in her field so that she can reach as much tasty grass as possible within a short walk.

The field is an N×NN \times N grid (1N4001 \le N \le 400). Cell (r,c)(r,c) (1r,cN1 \le r,c \le N) contains G(r,c)G(r,c) units of grass (0G(r,c)10000 \le G(r,c) \le 1000). From her starting cell, Bessie takes at most KK steps (0K2N0 \le K \le 2N). Each step moves her one cell north, south, east, or west.

Choose the best starting cell. Output the maximum total grass she can reach within KK steps.

Input

  • Line 1: integers NN and KK.
  • Lines 2 through N+1N+1: NN integers per line, row rr of the grid.

Output

  • Line 1: the maximum total grass reachable within KK steps from the best starting cell.

Hint

Try every starting cell and sum grass reachable within KK steps.