def main(): X, Y = map(int, input().split()) if X == Y: print(0) elif not Y: print(1) elif not X: print(2) elif not X + Y: print(3) else: print(-1) main()