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