I want to eat chicken
Time limit1sMemory limit256 MB
Each person buys as many chickens as his money allows; compute how many more Sangeon eats than Dooyoung given coupon rules.
- Level
Medium4 of 10
- Topics
- Math, Simulation, Implementation
- Solved
- No attempts yet
Problem

Building 301 at Seoul National University hides a fried chicken shop called Nupchicken. Every time you order a chicken there, the shop hands you coupons, and coupons buy one free chicken.
Dooyoung is not a regular, so a chicken he orders with coupons comes with no coupons at all. Sangeon is a regular, and the owner gives him coupons even for a chicken ordered with coupons.
Sangeon and Dooyoung each have won, and one chicken costs won. Each of them orders as many chickens as his money allows and takes a free chicken every time he has collected coupons. Find how many more chickens Sangeon eats than Dooyoung.
Input
The first line contains the number of test cases (). The test cases follow.
Each test case is one line with four integers: the price of one chicken (), the money available for chicken (), the number of coupons needed for one free chicken (), and the number of coupons given for one ordered chicken (), in that order.
Output
For each test case, print on its own line how many more chickens Sangeon eats than Dooyoung.