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