The first line contains the number of test cases T (1≤T≤20,000). The T test cases follow.
Each test case is one line with four integers: the price of one chicken P (1≤P≤50,000), the money available for chicken M (1≤M≤1,000,000), the number of coupons needed for one free chicken F (2≤F≤1,000), and the number of coupons given for one ordered chicken C (1≤C<F), in that order.