func_code_string: #include <bits/stdc++.h>   using namespace std;   bool flag = 0;   int work(int a, int n, int p) {     int t = a * 1ll * n / p;     if (!t) {       if (!flag) return a;       return max(a, p - a * n);     }     flag = 1;     int a1, n1, p1;     a1 = min(p % a, a - (p % a));     n1 = t;     p1 = a;     if (a * 1ll * n % p < a * 1ll * (p / a - 1)) n1--;     return work(a1, n1, p1);   }   int main() {     int t;     scanf( %d , &t);     while (t--) {       int a, n, p, h;       scanf( %d%d%d%d , &a, &n, &p, &h);       flag = 0;       if (work(a % p, n, p) <= h)         printf( YES n );       else         printf( NO n );     }     return 0;   }   