Multiplayer Pong (Small)

Decide which pong team misses first, or draws, from wall bounce heights with paddle speed limits and a fixed return order.

Medium6SimulationMathNo attempts yetTime limit5sMemory limit512 MB

Problem

Two teams play pong. Each player controls one paddle, which we treat as a single point, and one ball travels between the teams. Inside a team the players must return the ball in a fixed cyclic order. In a three-player team the first return belongs to P1, the second to P2, the third to P3, and the fourth to P1 again. The moment the player whose turn it is fails to touch the ball, the ball leaves the field and that player's team loses.

The field is a rectangle of height AA and width BB. Take the lower left corner as the origin and write a point of the field as (x,y)(x, y), so 0xB0 \le x \le B and 0yA0 \le y \le A. The first team has NN players and its paddles move only along the wall x=0x = 0. The second team has MM players and its paddles move only along the wall x=Bx = B. A paddle of the first team moves at most VV units per second, a paddle of the second team at most WW units per second. A paddle position is always a value in [0,A][0, A], and paddles of the same team pass through each other freely.

The ball starts at (X,Y)(X, Y) and moves VXV_X units to the right and VYV_Y units up each second. The horizontal speed of the ball may be zero. When the ball reaches the wall y=0y = 0 or the wall y=Ay = A it bounces with the angle of reflection equal to the angle of incidence, and its horizontal component is unchanged. At the moment the ball reaches x=0x = 0 or x=Bx = B, the paddle of the player whose turn it is must be exactly at the height of the ball. If the paddle is there, the ball bounces under the same reflection rule and only the sign of the horizontal component flips. If it is not, that player's team loses.

Both teams see the initial position and velocity of the ball, and then they may place their paddles anywhere on their own wall before the ball starts moving. After that a paddle moves only within its own speed limit. Every player plays optimally.

The game can run for a long time. Determine the final result.

Input

The first line has the number of test cases TT. Then TT test cases follow, each on four lines.

  • Line 1: the height AA and the width BB of the field.
  • Line 2: the number of players NN of the team guarding the wall x=0x = 0, and the number of players MM of the team guarding the wall x=Bx = B.
  • Line 3: the paddle speed VV of the first team and the paddle speed WW of the second team.
  • Line 4: the initial height YY, the initial horizontal coordinate XX, the vertical speed VYV_Y, and the horizontal speed VXV_X of the ball.

All values are integers and satisfy

  • 1T1001 \le T \le 100
  • 2A,B1062 \le A, B \le 10^6
  • 1N,M1061 \le N, M \le 10^6
  • 1V,W10121 \le V, W \le 10^{12}
  • 0<Y<A0 < Y < A
  • 0<X<B0 < X < B
  • 1012VY1012-10^{12} \le V_Y \le 10^{12}
  • 106VX106-10^6 \le V_X \le 10^6

Output

For each test case print one line in the form Case #x: y, where x is the test case number starting from 1 and y is one of these three answers.

  • DRAW if the game never ends.
  • LEFT z if the team on the wall x=0x = 0 wins. Here zz is the number of times the other team returns the ball.
  • RIGHT z if the team on the wall x=Bx = B wins. Here zz is the number of times the other team returns the ball.

Explanation

The picture shows the play of the first example. The ball bounces off the right wall at time 0.375. The first player of the RIGHT team returns it, for instance by leaving her paddle at that point from the start. The LEFT player returns it off the left wall at 0.875, and at 1.375 the second player of the RIGHT team returns it off the right wall by putting his paddle at the bounce point. At 1.875 the ball bounces off the left wall again, and the LEFT player arrives just in time: she covers the distance of 3 exactly in the one second she has. The next point where the ball reaches the right wall is too far for the first player of the RIGHT team. The second player of the RIGHT team could catch that ball, but the order rule does not allow it. If the RIGHT team had one more player, she would return the ball, and then the LEFT team would lose, because the ball would come too far up for the single LEFT player to reach in time.