import java.util.Scanner; public class No643 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int x=Integer.parseInt(sc.next()); int y=Integer.parseInt(sc.next()); if(x==y) { System.out.println(0); }else if(x==0) { System.out.println(2); }else if(y==0) { System.out.println(1); }else if(x==-y){ System.out.println(3); }else{ System.out.println(-1); } } }