N,M = map(int,input().split()) A = [] for _ in range(N): A.append(sum(list(map(int,input().split())))) ans = 0 if N == 1: print(A[0]) exit() ac = [A[0]] for i in range(1,N): if i%2 == 0: ac.append(ac[-1]+A[i]) else: ac.append(ac[-1]-A[i]) ac = [0]+ac print(ac) for i in range(len(ac)): for j in range(i+1,len(ac)): ans = max(ans,abs(ac[j]-ac[i])) print(ans)