I hope i did the question in correct way.please help me what was the mistake i was did

#include
using namespace std;
int main(){

long long m=0,scholarship=0,mid=0,n=0,x=0,y=0;
cin>>n>>m>>x>>y;
while(m>=x){
m=m-x;
scholarship++;
if(scholarship==n){
cout<<n;
exit(0);
}
}
mid=n-scholarship;
m=m+y*mid;
while(m>=x){
m=m-x;
scholarship++;
if(scholarship==n){
cout<<n;
exit(0);
}
}
cout<<scholarship;

}

hi @anishravula660
refer this -->

hi @anishravula660
i hope its clear now??

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.