beecrowd | 1881

Robotics Competition

By Antonio Roberto C. Jr., Universidade de São Paulo BR Brazil

Timelimit: 1

Malai advanced to the Thai national robotics contest finals, to be held next week. Each contestant specifies an instruction to her or his robot and the number of times this instruction should be executed. The robot that gets to closest to a certain target wins the contest.

Each robot is represented by a point (x,y) and it starts at the origin of the plane. Each instruction is defined as I(α, l), where α is an angle in degrees and l a length in meters. To execute instruction I(α, l), the robot must rotate α degrees counterclockwise around the origin and then move l meters to the right from its position.

Malai is a newbie at this contest and needs your help to find the robot's final position.

Input

The first line of the input has an integer T corresponding to the number of instances.

Each instance consists of a single line that contains the angle α (0 ≤ α ≤ 365), the length l (0 ≤ l ≤ 10), and the number N (1 ≤ N ≤ 1.000.000.000) of times that the instruction I(α, l) must be executed. Consider that α and N are integers and that l are rational.

Output

For each instance, print a single line with the coordinates (x, y), in meters, of the robot's final position after N executions of the instruction I(α, l). The coordinates x and y must be rounded and printed with 2 decimal digits.

Input Sample Output Sample

4

90 10 1

90 10 2

90 10 3

30 1.5 121

10.00 0.00

10.00 10.00

0.00 10.00

1.50 0.00