#Y1012. 迷途

迷途

Background:

FWXFWX is very adored of GuanGuan orz

Problem Description:

FWXFWX and GuanGuan live in a point a11 and amn in a rectangular town of size m * n (ensuring that they are on the same diagonal). Because FWXFWX wants to ask GuanGuan and FWXFWX's modem is broken, they have to go to GuanGuan. Because there are so many "good people" in the township, the FWXFWX has to pay the tolls. FWXFWX wants to know how many tolls it needs to pay.(The town map is shown in the figure below) image

Taking the town as a real matrix Amn, aij represents the toll to be paid here to ensure satisfaction. Please ask the minimum amount of tolls for FWXFWX.(Note:FWX FWX can only move up, down, left and right)

Input Format:

The first row, two positive integers n, m, represent the size of the matrix.

The next n rows, m positive integers, represent the toll FWXFWX needs to pay at each node.(Note: The point where FWXFWX and GuanGuan are located is 0)

Output Format:

One line, a positive integer, represents the minimum toll required for FWXFWX.

Input / output sample:

Enter # 1:

3 3
0 7 2
5 4 7
6 8 0

output #1:

16