#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;



int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int32 x, y;
	std::cin >> x >> y;
	int32 ans;
	if (x == y) {
		ans = 0;
	}
	else if (x == 0) {
		ans = 2;
	}
	else if (y == 0) {
		ans = 1;
	}
	else if (x + y == 0) {
		ans = 3;
	}
	else {
		ans = -1;
	}
	std::cout << ans << "\n";
	return 0;
}