#include #include #include #include #include #include using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } const ll INF = 1LL << 60; ll GCD(ll x, ll y) { if(y==0) return x; else return GCD(y,x%y); } int main() { ll A,B; cin >> A >> B; ll g = GCD(A,B); A /= g, B /= g; cout << g*GCD(A+B,g) << endl; }