#include using namespace std; int main() { long long a,b; cin>>a>>b; long long g = __gcd(a,b); a/=g,b/=g; cout<<(g*__gcd(a+b,g)); }