import sys import numpy as np x = np.fromstring(sys.stdin.buffer.read(), dtype=np.uint32, sep=' ') W = int(x[1]) s = x[2:].reshape(-1, W).sum(axis=1, dtype=np.uint32) s += s.sum(dtype=np.uint32) s.tofile(sys.stdout.buffer, sep='\n', format='%u')