405596: GYM102006 I Rise of the Robots

Memory Limit:256 MB Time Limit:6 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Rise of the Robotstime limit per test6 secondsmemory limit per test256 megabytesinputrobots.inoutputstandard output

You made a robot to compete in an international competition. The organizers require that each robot must complete a set of movements to test its reflexes and balance before the competition starts.

A robot will make n moves on a circular table of radius R centered at (0, 0), each move is in a straight line. For the ith move, the robot will move from its current location (x, y) to (x + dxi, y + dyi).

Everything is set for your test run, but you are faced with one final problem; you realized that your robot is out of balance. If any part of it gets off the table, it will fall and you will lose the competition. Your robot will be represented as a circle with radius r, with its location being the center of the circle.

Can you figure out a possible starting location for the robot to complete all the movements without falling?

Input

The first line of input contains an integer T, the number of test cases.

The first line of each test case contains three integers, n, R and r (1 ≤ n ≤ 250, 1 ≤ r < R ≤ 105), the number of moves, the radius of the table, and the radius of the robot.

The ith of the following n lines contains two integers dxi and dyi (|dxi| + |dyi| > 0), representing the ith move.

It is guaranteed that there is at least one valid starting position to place the robot on.

Output

For each test case, output two numbers (Sx, Sy) on a single line, the coordinates of a valid starting position.

Your answer is considered correct if by extending the radius of the table R by 10 - 4, the robot will be strictly inside the table throughout all moves.

ExampleInput
1
4 5 2
3 0
0 3
3 -3
-3 -3
Output
-3.000000000 0.000000000

加入题单

算法标签: