#include using namespace std; using ll=long long; using pll=pair; using tll=tuple; using ld=long double; const ll INF=(1ll<<60); #define rep(i,n) for (ll i=0;i<(ll)(n);i++) #define all(v) v.begin(),v.end() template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> n >> m; ll t=sqrtl(1e5+1); vector cnt(1e5,0); vector> imos(t,vector(2e5+1,0)); while(n--){ ll l,r,x,y; cin >> l >> r >> x >> y; ll a=(l/x)*x+y; if(a> a; cout << cnt[a] << '\n'; } }