Vasya and Chocolate

题意翻译

## 题意 $Vasya$最喜欢的超市里有一个优惠:如果顾客买$a$块巧克力,他就可以免费购买$b$块巧克力。这个优惠可以多次使用。$Vasya$现在有$s$卢布,他想免费得到尽可能多的巧克力。每块巧克力的价格是$c$卢布。请帮助$Vasya$计算出他最大能得到的巧克力数! ## 输入 第一行包含一个整数$t(1\le t\le 100)$-数据组数。 接下来的t行每一行包含4个整数$s$,$a$,$b$,$c(1\le s,a,b,c\le 10^9)$。$Vasya$有$s$卢布,优惠时必须购买的巧克力的数量$a$,免费获得的巧克力的数量$b$,以及一条的成本$c$。 ## 输出 输出$t$行表示每一次可得的最大巧克力数 ## 说明 样例一,$Vasya$可以买到$9$块,$3$块免费,另外买一块,所以他可以买$13$块。 样例二,$Vasya$买了$1000000000$块,免费得到了$1000000000000000000$块。所以他有$1000000001000000000$块。

题目描述

There is a special offer in Vasya's favourite supermarket: if the customer buys $ a $ chocolate bars, he or she may take $ b $ additional bars for free. This special offer can be used any number of times. Vasya currently has $ s $ roubles, and he wants to get as many chocolate bars for free. Each chocolate bar costs $ c $ roubles. Help Vasya to calculate the maximum possible number of chocolate bars he can get!

输入输出格式

输入格式


The first line contains one integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of testcases. Each of the next $ t $ lines contains four integers $ s, a, b, c~(1 \le s, a, b, c \le 10^9) $ — the number of roubles Vasya has, the number of chocolate bars you have to buy to use the special offer, the number of bars you get for free, and the cost of one bar, respectively.

输出格式


Print $ t $ lines. $ i $ -th line should contain the maximum possible number of chocolate bars Vasya can get in $ i $ -th test.

输入输出样例

输入样例 #1

2
10 3 1 1
1000000000 1 1000000000 1

输出样例 #1

13
1000000001000000000

说明

In the first test of the example Vasya can buy $ 9 $ bars, get $ 3 $ for free, buy another bar, and so he will get $ 13 $ bars. In the second test Vasya buys $ 1000000000 $ bars and gets $ 1000000000000000000 $ for free. So he has $ 1000000001000000000 $ bars.