#include #include using namespace std; using namespace atcoder; typedef int64_t lint; #define rep(i, n) for(int i=0; i; using vvi = vector>; template inline void vin(vector& v) { rep(i, v.size()) cin >> v.at(i); } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template inline void drop(T x) { cout << x << endl; exit(0); } template void vout(vector v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; } constexpr lint LINF = LLONG_MAX/2; vector factorList(lint n) { vector V; if (!(n % 2)) { while (!(n % 2)) { V.push_back(2); n /= 2; } } int rn = sqrt(n); vector v(rn+1); for(lint i = 3; i <= rn && n > 1; i += 2) { if(!v.at(i)) { if (!(n % i)) { while (!(n % i)) { V.push_back(i); n /= i; } } v.at(i) = 1; for(lint j = i*i; j <= rn; j += i) { v.at(j) = 1; } } } if (n != 1) V.push_back(n); return V; } int main() { lint X, A, Y, B; cin >> X >> A >> Y >> B; lint a=0, b=0, c=0, x, y, z; vi v = factorList(X); map m; for (auto t : v) m[t]++; for (auto p : m) m[p.first] = p.second*A; vi w = factorList(Y); map n; for (auto t : w) n[t]++; for (auto p : n) n[p.first] = p.second*B; for (auto p : n) { if (!m.count(p.first)) drop("No"); if (p.second > m[p.first]) drop("No"); } std::cout << "Yes" << '\n'; }