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