{
TASK:apple
LANG:Pascal
}

program apple;

type TLongMatrix = array[1..70,1..70] of LongInt;
     TMatrix = array[1..70,1..70] of Integer;

var InputMatrix: TMatrix;
    M, N: Integer;
    Answer: LongInt;


procedure Input;
var i, j: Integer;
begin
 ReadLn(M,N);

 for i := 1 to M do begin

  for j := 1 to N do Read(InputMatrix[i,j]);
  ReadLn;

 end;
end;

function Max(a, b: LongInt): LongInt;
begin
 If (a > b) then Max := a
 else Max := b;
end;

function GetBestPath(amatrix: TMatrix): LongInt;
var FuncMatrix: TLongMatrix;
    i, j: Integer;
begin
 FuncMatrix[1,1] := amatrix[1,1];

 for i := 2 to M do FuncMatrix[i,1] := amatrix[i,1] + FuncMatrix[i - 1,1];
 for i := 2 to N do FuncMatrix[1,i] := amatrix[1,i] + FuncMatrix[1,i - 1];

 for j := 2 to N do begin
  for i := 2 to M do begin
   FuncMatrix[i,j] := amatrix[i,j] + Max(FuncMatrix[i - 1,j],FuncMatrix[i,j - 1]);
  end;
 end;

 GetBestPath := FuncMatrix[M,N];
end;

procedure Process(x, y: Integer; amatrix: TMatrix);
var Ans1, Ans2: LongInt;
    Mat1, Mat2: TMatrix;
begin
 If (x = N) and (y = M) then begin
  Answer := Answer + GetBestPath(amatrix);
  Exit;
 end;

 Ans1 := - 1; Ans2 := - 1;

 If (x < N) then begin

  Ans1 := amatrix[y,x + 1];
  Mat1 := amatrix;
  Mat1[y,x + 1] := 0;
  Inc(Ans1,GetBestPath(Mat1));

 end;

 If (y < M) then begin

  Ans2 := amatrix[y + 1,x];
  Mat2 := amatrix;
  Mat2[y + 1,x] := 0;
  Inc(Ans2,GetBestPath(Mat2));

 end;

 If (Ans1 >= Ans2) then begin

  Inc(Answer,amatrix[y,x + 1]);
  Process(x + 1,y,Mat1);

 end else begin

  Inc(Answer,amatrix[y + 1,x]);
  Process(x,y + 1,Mat2);

 end;
end;

begin
 Input;

 Answer := InputMatrix[1,1];
 InputMatrix[1,1] := 0;

 Process(1,1,InputMatrix);

 WriteLn(Answer);
end.
