#include <bits/stdc++.h>
using namespace std;
const int N=100+5;
const int M=20000+5;
const int inf=0x7fffffff;
int n,m;
int a[N][M]={0},mx[M];
inline int read(){
int ans=0,sgn=1;char ch=getchar();
while(!isdigit(ch)){
if (ch=='-')sgn=-1;
ch=getchar();
}
while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
return ans*sgn;
}
int main(){
freopen ("perfecttour.in","r",stdin);
freopen ("perfecttour.out","w",stdout);
n=read();m=read();m--;
for (int i=1;i<=n;i++){
for (int j=1;j<=m;j++){
a[i][j]=read();mx[j]=-inf;
}
}
for (int i=1;i<=m;i++){
for (int j=1;j<=n;j++)mx[i]=max(mx[i],a[j][i]);
}
int ans=0,now=0;
for (int i=1;i<=m;i++){
now+=mx[i];
if (now<0)now=0;
else ans=max(ans,now);
}
printf("%d\n",ans);
return 0;
}