#include #include #include #include #include #include #include #include using ll = long long; using namespace std; ll GCD(ll a, ll b) { if (b == 0) return a; return GCD(b, a % b); } int main(void) { ll A, B; cin >> A >> B; if (A < B) swap(A, B); ll d = GCD(A, B); ll ans = d * GCD(A / d + B / d, d); cout << ans << endl; return 0; }