This page is still under construction.

Parts of this page are still being built. What you see may change.

Balancing Weights

Interview

Time limit1sMemory limit256 MB

Summary
You sum the signed positions of the weights and report whether the lever tips left, tips right, or stays balanced.
Level

Easy1 of 10

Topics
Implementation, Math
Solved
No attempts yet

Problem

A lever 20 meters long rests on a massless support at its exact middle and is balanced. Several weights are placed on the lever, and you have to decide which side goes down, if any.

The torque produced by a single weight is

τ=m×d\tau = m \times d

where mm is the mass of the weight and dd is its distance from the center. The angular acceleration of the lever follows α=τ/I\alpha = \tau / I, and the moment of inertia is I=∫r2 dmI = \int r^2\,dm, where rr is the perpendicular distance to the axis of rotation.

The lever itself weighs 2000 grams, spread evenly along its length. Each weight weighs 100 grams and is treated as a point mass with no size.

Input

The first line contains TT, the number of test cases. Each test case begins with a line containing NN, the number of weights. The next line contains the positions W1,W2,…,WNW_1, W_2, \dots, W_N of those weights, separated by spaces. A position is measured from the center of the lever in centimeters. A negative WiW_i puts the weight to the left of the center, a positive one puts it to the right.

  • 0<T≤1000 < T \le 100
  • 0<N≤1000 < N \le 100
  • −1000≤Wi≤1000-1000 \le W_i \le 1000

Output

For each test case, print one line. Print Left if the lever tips to the left, Right if it tips to the right, and Equilibrium if it does not tip to either side.

Examples4

  1. Example 1

    Input
    3
    3
    -2 0 2
    1
    4
    4
    4 -2 0 -3
    
    Expected output
    Equilibrium
    Right
    Left
    
  2. Example 2

    Input
    1
    1
    0
    
    Expected output
    Equilibrium
    
  3. Example 3

    Input
    2
    1
    -1000
    1
    1000
    
    Expected output
    Left
    Right
    
  4. Example 4

    Input
    3
    2
    -1 1
    2
    1 1
    2
    -1 -1
    
    Expected output
    Equilibrium
    Right
    Left