mod=10**9+7 def solve(): A,N=map(int,input().split()) C=[0]*A M=A*N R=0 for i in range(31,-1,-1): v=R+(1<