N,M,K = map( int, input().split()) A = [] for i in range(N): a=sorted(map(int, input().split()),reverse=True) A.append(a) print(sum(A[i][0] for i in range(N)))