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