#include using namespace std; int main() { int64_t a, b; cin >> a >> b; int c = 0; if (a > b) { if (a <= (3 * b + 1)) { c = (a + b) - (a + b) / 2 * 2; } else { c = a - 3 * b; } } else if (a < b) { if (b <= (3 * a + 1)) { c = (a + b) - (a + b) / 2 * 2; } else { c = b - 3 * a; } } else { c = 0; } cout << c << endl; }