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