n,m = map(int,input().split()) res = [[0]*n for _ in range(m)] for i in range(n): r = map(int,input().split()) for j,rj in enumerate(r): res[j][i] = rj M = 1<>i&1: continue nmask = mask|(1<