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