x,y=map(int,input().split()) if x==y: print(0) elif x==0: print(2) elif y==0: print(1) else: x=x+y if x==0: print(3) else: print(-1)