import sys import numpy as np readline = sys.stdin.readline n, m = map(int, readline().split()) a = b = 0 for i in range(n): umai = np.sum(np.array(readline().split(), dtype=np.int64), dtype=np.int64) a, b = max(b - umai, a), max(a + umai, b) print(max(a, b))