D1, D2 = list(map(int, input().split())) if D1 == D2/2 and D1 == D2: print(4) elif D2 < D1 < D2/2+D1: print(8) else: print(0)