a, b = map(int, input().split())
lis = []
for i in range(a):
    lis += [int(j) for j in input().split() if int(j) > 0]
print(sum(lis))