eolymp
bolt
Try our new interface for solving problems
Problems

Von Neumann`s Fly

Von Neumann`s Fly

The following problem was prosed to John von Neumann:

Two bicyclists a and b start riding toward each other at the same time from places that are 250 miles apart, a traveling at 10 miles per hour, and b at 15 miles per out. At the same time, a fly leaves the front wheel of a's bicycle, and flies toward b's bicycle, he turns around and flies back. As the bicycles approach each other, it continues flying back and front, touching each front wheel in turn, until, alas, he is crushed between them. Since the fly travels faster than either cyclist, he makes an infinite numbers of trips, yet travels a finite distance (the infinite series converges). How far did the fly travel?

Von Neumann immediately the infinite series (in his head!), and arrived at the correct answer: 200 miles.

You are to write a program that solves a more general version of that problem, with varying initial distances and speeds.

Input

Contains the number of data sets p (1p1000) that follow. Each data set should be processed identically and independently.

Each data set consists of a single line containing five values: the data set number n and four floating-point values: d (the initial distance between the bicycles, 10d1000), a (cyclist a's speed in miles per hour, 1a30), b (cyclist b's speed in miles per hour, 1b30), and f (the fly's speed in miles per hour, ab < f50).

Output

For each data set there is one line of output. It contains the data set number followed be a single space, followed by the number of miles traveled be the fly, (the sum of the infinite series described by the input values), accurate to two decimal places.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
1 250 10 15 20
2 10.7 3.5 4.7 5.5
3 523.7 15.3 20.7 33.3
4 1000 30 30 50
5 500 15 15 25
Output example #1
1 200.00
2 7.18
3 484.42
4 833.33
5 416.67
Source 2013 ACM Greater New York Region, October 27, Problem B