#include #include #include #include #include #include #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower using namespace std; using ll = long long; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) ll Max(ll(a), ll(b), ll(c)) { return max(max(a, b), c); } ll Min(ll(a), ll(b), ll(c)) { return min(min(a, b), c); } bool kai(ll A, ll B, ll T,ll N,vector H) { ll an = 0; rep(i, N) { if (H[i] > B * T) { an += max(((H[i] - B * T - 1) / (A - B)) + 1, ll(0)); } } if (an <= T) return true; else return false; } bool isOK(ll A, ll B, ll T, ll N, vector H) { if (kai(A,B,T,N,H)) return true; else return false; } ll binary_search(ll A,ll B,ll N, vector H) { int left = 0; int right = 1e13; while (right - left > 1) { int mid = left + (right - left) / 2; if (isOK(A,B,mid,N, H)) right = mid; else left = mid; } /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */ return right; } ll ketawa(ll N) { ll ans = 0; while (N > 0) { ans += N % 10; N /= 10; } return ans; } ll gcd(ll(a), ll(b)) { ll c = a; while (a % b != 0) { c = a % b; a = b; b = c; } return b; } int main() { ll A, B; cin >> A >> B; ll g = gcd(A, B); ll a = A / g; ll b = B / g; cout << g * (gcd(a + b, g)) << endl; }