7669: Poker and Walk

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:1 解决:1

题目描述

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

来源/分类