游客 Signup | Login
中文 | En

3932 - Poker and Walk

通过次数

0

提交次数

0

Time Limit : 1 秒 Memory Limit : 128 MB

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: <br />

<p class="MathJax_Display">
	<span class="MathJax" id="MathJax-Element-7-Frame"><span class="mrow" id="MathJax-Span-30">1≤V≤10</span></span> 
</p>
<p class="MathJax_Display">
	<span class="MathJax"><span class="mrow"><span class="mo" id="MathJax-Span-36"></span>1≤T≤100</span></span> 
</p>
<p class="MathJax_Display">
	<span class="MathJax"><span class="mrow"><span class="mo" id="MathJax-Span-42"></span>1≤T<span>0</span>≤100</span></span> 
</p>
<p class="MathJax_Display">
	<span class="MathJax"><span class="mrow"><span class="mo" id="MathJax-Span-50"></span>1≤L≤1000</span></span> 
</p>

Output

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

Examples

Input Format

2
1 3 1 10
1 4 2 10

Output Format

13.000
14.000