dp = [0] * 2 # 最後にたべたものを2で割った余り dp[1] = -(1 << 60) N,M = map(int,input().split()) for _ in range(N): val = sum(map(int,input().split())) new_dp = dp.copy() new_dp[0] = max(new_dp[0], dp[1] - val) new_dp[1] = max(new_dp[1], dp[0] + val) dp = new_dp print(max(dp))