#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef unsigned long long ull; typedef long long ll; typedef pair pii; typedef pair pll; typedef pair P; const ll INF = 1ll<<60; const ll MOD = 1000000007; const double EPS = 1e-10; vector primeFactorization(ll n) { vector res; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) res.push_back(pll(i, 0)); while (n % i == 0) { n /= i; res[res.size() - 1].second++; } } if (n > 1) res.push_back(pll(n, 1)); return res; } int main() { ll a, b; cin >> a >> b; vector v = primeFactorization(a + b); ll ans = 1; REP(i, v.size()) { REP(j, v[i].second) { if (a % v[i].first == 0) a /= v[i].first; else if (b % v[i].first == 0) b /= v[i].first; else break; ans *= v[i].first; } } cout << ans << endl; return 0; }