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