Rain on your Fat brother, C语言

Problem Description
After retired form the ACM/ICPC competition, Fat brother starts his civil servant’s life with his pretty girl friend Maze. As far as we known for this holy job, we can imagine how a decadent life they are dealing with!

But one day, Fat brother and Maze have a big quarrel because of some petty things and Maze just run away straight from him. It’s raining cats and dogs outside, our hero Fat brother feel very worried about the little princess so he decide to chase her. As Maze is a tsundere girl, she would feel angry when she touches the rain until she meets the Fat brother.

To simplify this problem, we can just consider each person as a point running along the X coordinate from right to left and the rain as a combination of an isosceles triangle and a half round. The speed of Maze is v1 unit per second and the speed of Fat brother is v2 unit per second (v1 < v2). The place where they have a quarrel is (x, 0) and Fat brother start to chase Maze after T second. You can assume that the rain is doing the uniform linear motion (drop with the same speed forever). Your task is calculating how long (time) the Maze is in the rain. The Maze is considered in the rain even if the point representing her is just touch the border. See the picture for more detail.

Input
The first line contains only one integer T (T<=200), which is the number of test cases. For each test case, first line comes five positive integer v1, v2, v, t, x (v1<v2). v1 is the speed of Maze, v2 is the speed of Fat brother, v is the speed of the rain, you can assume that all rain is in a same speed, t means Fat brother starts to chase Maze after t second, x means they have a quarrel in (x, 0). Then a line with an integer n means that there is n rain begin to drop when Maze start running, 1<=n<=1000. Then n lines describe the rain. Each line contains four integers x0, y0, r, h. (x0, y0) is the center of the circle, r is the radius of the circle, h is the height of the triangle. All the number mentioned before except x0 are positive and no large than 1000. x0 is no large than 1000 and no less than -1000. Note that the point (x, 0) may in the rain in the beginning. Two rains may intersect with each other. See the picture for more detail.

Output
For each test case, output the case number first, then output how long (time) Maze is in the rain, round to 4 digits after decimal point.

Sample Input
4
1 2 1 100 1
1
1 1 1 1
1 2 1 100 1
1
2 1 1 1
1 2 1 100 1
1
-9 9 10 10
2 3 1 100 1
1
-9 9 10 10

Sample Output
Case 1: 1.0000
Case 2: 0.0000
Case 3: 12.0534
Case 4: 8.0428