#include using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++) #define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++) #define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--) #define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) ((ll)(x).size()) #define len(x) ((ll)(x).length()) #define endl "\n" typedef unsigned long long ull; typedef long long ll; ull modmul(ull a, ull b, ull M) { ll ret = a * b - M * ull(1.L / M * a * b); return ret + M * (ret < 0) - M * (ret >= (ll)M); } ull modpow(ull b, ull e, ull mod) { ull ans = 1; for (; e; b = modmul(b, b, mod), e /= 2) if (e & 1) ans = modmul(ans, b, mod); return ans; } bool isPrime(ull n) { if (n < 2 || n % 6 % 4 != 1) return (n | 1) == 3; ull A[] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022}, s = __builtin_ctzll(n-1), d = n >> s; for (ull a : A) { // ^ count trailing zeroes ull p = modpow(a%n, d, n), i = s; while (p != 1 && p != n - 1 && a % n && i--) p = modmul(p, p, n); if (p != n-1 && i != s) return 0; } return 1; } ull pollard(ull n) { auto f = [n](ull x) { return modmul(x, x, n) + 1; }; ull x = 0, y = 0, t = 0, prd = 2, i = 1, q; while (t++ % 40 || __gcd(prd, n) == 1) { if (x == y) x = ++i, y = f(x); if ((q = modmul(prd, max(x,y) - min(x,y), n))) prd = q; x = f(x), y = f(f(y)); } return __gcd(prd, n); } vector factor(ull n) { if (n == 1) return {}; if (isPrime(n)) return {n}; ull x = pollard(n); auto l = factor(x), r = factor(n / x); l.insert(l.end(), all(r)); return l; } template map factorize2(T n) { map res; for (long long i = 2; (i * i) <= n; i++) { if (n % i) continue; res[i] = 0; while((n % i) == 0) { n /= i; res[i]++; } } if (n != 1) res[n] = 1; return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); ll a, b; cin >> a >> b; map af = factorize2(a); map bf = factorize2(b); map pf = factorize2(a + b); map abf; for(auto x : af) abf[x.first] = x.second; for(auto x : bf) abf[x.first] += x.second; ll ans = 1; for(auto x : pf) { ll v = min(x.second, abf[x.first]); rep(i, v) ans *= x.first; } cout << ans << endl; return 0; }