def main(): import sys input=sys.stdin.buffer.readline n,m=map(int,input().split()) a=[sum(list(map(int,input().split()))) for _ in range(n)] dp=[[-float('inf')]*(n+1) for _ in range(2)] dp[0][0]=0 for i in range(n): dp[0][i+1]=max(dp[0][i],dp[1][i]-a[i]) dp[1][i+1]=max(dp[1][i],dp[0][i]+a[i]) print(max(dp[0][n],dp[1][n])) main()