/***********************************
Problem: HDU 2845 Beans
Time: 140MS
Memory: 248K
Accepted Time: 2009-08-03 20:57:11
Tip: DP
************************************/
#include <stdio.h>
#define maxs(a,b) (a>b?a:b)
int main()
{
int dp[2],dp2[2];
int m,n,t;
while(scanf("%d%d",&m,&n)!=EOF)
{
int i,j,temp;
dp2[0]=dp2[1]=0;
for(i=1;i<=m;i++)
{
dp[0]=dp[1]=0;
for(j=1;j<=n;j++)
{
scanf("%d",&temp);
t=dp[0];
dp[0]=maxs(dp[0],dp[1]);
dp[1]=t+temp;
}
t=dp2[0];
dp2[0]=maxs(dp2[0],dp2[1]);
dp2[1]=t+maxs(dp[0],dp[1]);
}
printf("%d/n",maxs(dp2[0],dp2[1]));
}
return 0;
}