#include #include #include #include int descending_compare(const void *a, const void *b){ if (*(int*)a > *(int*)b){ return -1; }else if (*(int*)a == *(int*)b){ return 0; }else{ return 1; } } int ascending_compare(const void *a, const void *b){ if (*(int*)a < *(int*)b){ return -1; }else if (*(int*)a == *(int*)b){ return 0; }else{ return 1; } } int lower_bound(int *a, int n, int key){ int left, mid, right; left = 0, right = n; mid = (left + right)/2; while ((left+1 != mid || mid+1 != right) && mid != left){ if (key > a[mid]){ left = mid; }else{ right = mid+1; } mid = (left + right)/2; } if (a[left] >= key)return left; if (a[mid] >= key)return mid; if (a[right] >= key)return right; return n; } //greatest common divisor unsigned long gcd(unsigned long x, unsigned long y){ if (y == 0){ return x; }else if (x > y){ return gcd(y, x % y); }else{ return gcd(x, y % x); } } long long factorial(int x){ long long rtn = 1; int i; for (i = x; i > 1; i--){ rtn = (rtn*i); } return rtn; } int main(void){ int x, y; scanf("%d %d", &x, &y); if (x == y){ printf("0\n"); return 0; } if (x == 0){ printf("2\n"); return 0; } if (y == 0){ printf("1\n"); return 0; } if (x*-1 == y){ printf("3\n"); return 0; } if (y*-1 == x){ printf("4\n"); return 0; } printf("-1\n"); return 0; }