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