typedef long long ll; typedef long double ld; #include using namespace std; #define int long long vector > prime_factorize(long long n) { vector > res; for (long long p = 2; p * p <= n; ++p) { if (n % p != 0) continue; int num = 0; while (n % p == 0) { ++num; n /= p; } res.push_back(make_pair(p, num)); } if (n != 1) res.push_back(make_pair(n, 1)); return res; } signed main(){ ll x,a,y,b; std::cin >> x>>a>>y>>b; auto xxe = prime_factorize(x); map xe,ye; for (auto e : xxe) { xe[e.first] = e.second; } auto yye = prime_factorize(y); for (auto e : yye) { ye[e.first] = e.second; } for (auto e : ye) { if(xe[e.first]*a