Easy Problem

Time Limit: 1000 ms

Memory Limit: 65535 ms

Description

In space coordinate, calculate a position(x1,y1,z1) after point(x,y,z) rotating A degrees around a vector.

Input

The first line contains an integer t ( 1 <= t <= 100 ): the number of test cases. Then for each test case:First line contains three numbers x0,y0,z0,where x,y,z are the position of the point.Second line contains three numbers x2,y2,z2,where x2,y2,z2 are the position of the point in the vector.Third line contains three numbers dx,dy,dz,where dx,dy,dz are the direction of the vector.The last line contains a number A,where A is the degree.

Output

For each test case, output the result in the form of sample.You should print the case number and the position(x1,y1,z1) after point(x,y,z) rotating A degrees around a vector.Your answer is supposed to be rounded to three decimal digits.

Sample Input

2
5.1 10.1 11.1
2.0 3.0 4.0
1.0 1.0 1.0
360
5.0 10.0 11.0
2.0 3.0 4.0
1.0 1.0 1.0
180

Sample Output

Case 1:
5.100 10.100 11.100
Case 2:
10.333 7.333 8.333

Hint

None

Source

陶翔专场练习赛

提交代码