#include<bits/stdc++.h>
using namespace std;
int n, m, a[110][20010], maxn[20010], c[20010], ans = 0;
signed main() {
freopen("perfecttour.in", "r", stdin);
freopen("perfecttour.out", "w", stdout);
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; i ++) {
for(int j = 1; j < m; j ++) {
scanf("%d", &a[i][j]);
}
}
memset(maxn, -0x3f, sizeof(maxn));
for(int i = 1; i <= n; i ++) {
for(int j = 1; j < m; j ++) {
maxn[j] = max(maxn[j], a[i][j]);
}
}
for(int i = 1; i < m; i ++) {
// cout << maxn[i] << endl;
c[i] = c[i - 1] + maxn[i];
}
int x = 0;
for(int i = 1; i < m; i ++) {
x += maxn[i];
if(x < 0) {
x = 0;
}
ans = max(ans, x);
}
cout << ans << endl;
return 0;
}