A,B=map(int,input().split()) if A==B: print(4) elif A*2B*2: print(0) else: print(8)