#include #define M_PI 3.14159265358979323846 // pi using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector VI; typedef pair P; typedef tuple t3; typedef tuple t4; #define rep(a,n) for(ll a = 0;a < n;a++) #define repi(a,b,n) for(ll a = b;a < n;a++) #include using namespace std; const ll mod = 1e9 + 7; const ll INF = 1e15; class Primes { private: vector Prime_Number; vector is_prime_; public: Primes(int N) { is_prime_.resize(N + 1, true); is_prime_[0] = is_prime_[1] = false; for (int i = 0; i < N + 1; i++) { if (is_prime_[i]) { Prime_Number.push_back(i); for (int j = 2 * i; j <= N; j += i) is_prime_[j] = false; } } } int operator[](int i) { return Prime_Number[i]; } int size() { return Prime_Number.size(); } int back() { return Prime_Number.back(); } bool isPrime(int q) { return is_prime_[q]; } }; class Divisor { private: vector F; vector> pfactorize; public: Divisor(ll N) { for (ll i = 1; i * i <= N; i++) { if (N % i == 0) { F.push_back(i); if (i * i != N) F.push_back(N / i); } } sort(begin(F), end(F)); Primes p((ll)sqrt(N) + 1); for (int i = 0; i < p.size(); i++) { pfactorize.emplace_back(p[i], 0); while (N % p[i] == 0) { N /= p[i]; pfactorize.back().second++; } if (pfactorize.back().second == 0) pfactorize.pop_back(); } if (N > 1) pfactorize.emplace_back(N, 1); } int size() { return F.size(); } const vector>& pfac() { return pfactorize; } const ll operator[](int k) { return F[k]; } }; int main() { ll l, r, m, k; cin >> l >> r >> m >> k; if (k == 0 || l == 0) { cout << "Yes" << endl; return 0; } Divisor md(m); Divisor kd(k); unordered_map mmap; for (auto p : md.pfac()) { mmap[p.first] = p.second; } ll unit = 1; for (auto p : kd.pfac()) { auto a = p.second - mmap[p.first]; for (int j = 0; j < a; j++) { unit *= p.first; } } auto i = m * unit / k; auto left = l / i; auto right = r / i; if (left != right) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }