#include using namespace std; typedef long long ll; int rnd(double x) { double ret; ret = round(x * 100000) / 100000; return round(ret); } int main(void) { #ifdef DEBUG freopen("input.txt", "r", stdin); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); int A, B; cin >> A >> B; double a, b; a = A ? 1 : 0; b = B ? 1 : 0; int a_, b_; while (1) { if (A) { a_ = rnd(a / (a + b) * 100); if (a_ < A) { a++; continue; } else if (a_ > A) { b++; continue; } if (B) { b_ = rnd(b / (a + b) * 100); if (b_ < B) { b++; continue; } else if (b_ > B) { a++; continue; } } } break; } cout << a + b << endl; return 0; }