Problem A
Dhaka Bots

Input: Standard Input

Output: Standard Output

 

Being the expert programmer that you are, you have decided to put your skills to proper use by making life easier for all vehicle-riding inhabitants of Dhaka city. That is right, you are now in the middle of a project that will eliminate all traffic jams! In a sudden fit of enthusiasm you start to create the control software for those autonomous vehicles, only to realize it is harder than it seemed. You are now to create a small part of that software.

 

The case you need to handle is simply this: find the time of collision between two vehicles, both going at (possibly different) constant speeds, one of them in a straight line and the other in a circle in counterclockwise direction. You may assume that the vehicles are running on a flat 2D plane, and that they can be modeled as square of a given size with edges parallel to a fixed Cartesian coordinate system at all times.

 

 

Input

The input file may contain multiple test cases (at most 100). The first line of the input file consists of a single non-negative integer t, the number of test cases in the file. This line is followed by t test cases, each consisting of exactly two lines of input. The first line describes the vehicle going in a straight line and has the format sA xA yA vAx vAy (without the quotes). sA is the length of each edge of the square representing this vehicle, (xA,yA) is its starting point of the center of the square, (vAx, vAy) is its velocity in unit distance traveled per unit time. The second line of input in a test case represents the vehicle going round in a circle, and has the format sB xB yB cx cy vB. Once again, sB is the size of the square representing this vehicle, and (xB,yB) is the starting point of the center of this square. (cx, cy) is the center of the circular path followed by the center of this square, and vB is its linear speed. All input numbers (other than t) are real numbers with at most two decimal places. They will also satisfy the following constraints: |xA|, |yA|, |xB|, |yB|, |cx| |cy| 20000, |vAx|, |vAy| 200, 0 vB 200, 0 < sA, sB 100. It is also guaranteed that the two squares do not already overlap in their given starting states.

 

Output

There should be a single line of output for each test case in the input file, and it should have the format “Case c: t”. c is the case number, starting from 1, and t is the time it takes before the vehicles collide. Values within an absolute error of 10-5 of the actual answer will be accepted. If they never collide after starting in the state given, t should be replaced with the string “never”. Note that, for this problem, just grazing across the sides or just touching corners is not considered a collision.

 

 

Sample Input                                                 Output for Sample Input

2

2 -10 -10 1 1

2 0 5 0 0 10

2 -10 -10 1 1

2 0 5 0 0 1

Case 1: 7.216133

Case 2: never

 

Problemsetter: Samee Zahur

Special Thanks to: Manzurur Rahman Khan