a, b = map(int, input().split()) if a == b: print(0) elif a*b == 0: print(1 if b==0 else 2) elif abs(a) == abs(b): print(3) else: print(-1)