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