#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve() {
    int a, b;
    cin >> a >> b;
    if(a==b){
        cout<<0<<endl;
    }else if(a==0){
        cout<<2<<endl;
    }else if(b==0){
        cout<<1<<endl;
    }else if(abs(a)==abs(b)){
        cout<<3<<endl;
    }else{
        cout<<-1<<endl;
    }
}
signed main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cout << fixed << setprecision(3);
    int t = 1;
    //  cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}