#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<ll,ll> P;
typedef modint1000000007 mint;
ll gcd(ll a,ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(0);
    ll a,b;
    cin>>a>>b;
    ll g=gcd(a,b);
    cout<<g*gcd(a/g+b/g,g)<<endl;

    
}