#include #include using namespace std; int main() { int A, B; cin >> A >> B; int ans = 0; for (int i = 1; i <= A * B; ++i) { bool ok = false; for (int j = 0; j <= B; ++j) { for (int k = 0; k <= A; ++k) { if (j * A + k * B == i) { ok = true; } } } if (!ok) ++ans; } cout << ans << endl; return 0; }