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