#include #include #include using namespace std; int gcd(int a,int b) { while(b) { int t=a%b; a=b; b=t; } return a; } long long M; int A,B,K; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T;cin>>T; for(;T--;) { cin>>M>>A>>B>>K; if(A=K) { long long lim=(M-K)/A-i; if(lim>=0)ans+=lim/B+1; } } cout<