The following problem was proposed to John von Neumann:
Two bicyclists and start riding toward each other at the same time from places that are miles apart, traveling at miles per hour, and at miles per hour. At the same time, a fly leaves the front wheel of 's bicycle, and flies toward 's bicycle, it 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, it is crushed between them. Since the fly travels faster than either cyclist, it makes an infinite number of trips, yet travels a finite distance (the infinite series converges). How far did the fly travel?
Von Neumann immediately computed the infinite series (in his head!), and arrived at the correct answer: miles.
You are to write a program that solves a more general version of that problem, with varying initial distances and speeds.
Contains the number of data sets (1 \leq p \leq 1000) 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 and four floating-point values: (the initial distance between the bicycles, 10 \leq d \leq 1000), (cyclist 's speed in miles per hour, 1 \leq a \leq 30), (cyclist 's speed in miles per hour, 1 \leq b \leq 30), and (the fly's speed in miles per hour, a \leq b < f \leq 50).
For each data set there is one line of output. It contains the data set number followed by a single space, followed by the number of miles traveled by the fly, (the sum of the infinite series described by the input values), accurate to two decimal places.
Primer 1