#1134. Poker and Walk

Poker and Walk

说明

One day, Moat invited TeStatic to play poker at teaching building 9, and TeStatic was in teaching building 7 at that time.

TeStatic has special walking habit. He will stop T0 seconds after every T seconds' walking. We know that the distance between teaching building 7 and teaching building 9 is L meters, and the speed of TeStatic when he walks is V meters pre second.

So, how much time that Moat had to wait?

输入格式

In the first line of input file, there will be a positive integer T , indicating the number of data set.
Each data set contains a line with 4 integers V,T,T0,L . The meaning of them has been stated in Problem Description.

We guarantee that:

1≤V≤10

1≤T≤100

1≤T0≤100

1≤L≤1000

输出格式

For each data set of input, print the time asked in second (rounded to 3 decimal places) in a line.
2
1 3 1 10
1 4 2 10
13.000
14.000

Source

输入输出练习