11234: Poker and Walk

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:1 Solved:0

Description

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?

Input

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

Output

For each data set of input, print the time asked in second (rounded to 3 decimal places) in a line.

Sample Input Copy

2
1 3 1 10
1 4 2 10

Sample Output Copy

13.000
14.000