program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
s : array [0..105, 0..105] of integer;
i, j, max, max1 : integer;
x, n : shortint;
q : boolean;
begin
max := -100;
max1 := -100;
q := false;
read(n);
for i := 0 to n do
begin
s[0, i] := 0;
s[i, 0] := 0;
end;
for i := 1 to n do
for j := 1 to n do
begin
read(x);
if x >= 0 then q := true;
if max1 < x then max1 := x;
s[i, j] := s[i-1,j] + s[i,j-1] + x - s[i-1,j-1];
if s[i, j] > max then max := s[i, j];
if s[i, j] < 0 then s[i, j] := 0;
end;
if q then writeLn(max)
else writeLn(max1);
end.