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