I want to eat chicken

Each person buys as many chickens as his money allows; compute how many more Sangeon eats than Dooyoung given coupon rules.

Medium4MathSimulationImplementationNo attempts yetTime limit1sMemory limit256 MB

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 CC coupons, and FF 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 MM won, and one chicken costs PP won. Each of them orders as many chickens as his money allows and takes a free chicken every time he has collected FF coupons. Find how many more chickens Sangeon eats than Dooyoung.

Input

The first line contains the number of test cases TT (1T20,0001 \le T \le 20{,}000). The TT test cases follow.

Each test case is one line with four integers: the price of one chicken PP (1P50,0001 \le P \le 50{,}000), the money available for chicken MM (1M1,000,0001 \le M \le 1{,}000{,}000), the number of coupons needed for one free chicken FF (2F1,0002 \le F \le 1{,}000), and the number of coupons given for one ordered chicken CC (1C<F1 \le C < F), in that order.

Output

For each test case, print on its own line how many more chickens Sangeon eats than Dooyoung.