from typing import*classSolution:defmatrixScore(self,A: List[List[int]])->int:# n行 m列
n =len(A)
m =len(A[0])for i inrange(n):if A[i][0]==0:for j inrange(m):if A[i][j]==1:
A[i][j]=0else:
A[i][j]=1# i 列 j 行for i inrange(m):
count0 =0
count1 =0for j inrange(n):if A[j][i]==0:
count0 +=1else:
count1 +=1if count0 > count1:for j inrange(n):if A[j][i]==1:
A[j][i]=0else:
A[j][i]=1print(A)
num =0for i inrange(n):
temp =0for j inrange(m):
temp = temp*2+ A[i][j]
num += temp
return num
ans = Solution()
n =int(input())
m =int(input())
A =[[0,0,1,1],[1,0,1,0],[1,1,0,0]]print(ans.matrixScore(A))