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