Problem:
Score : 100 points

Problem Statement

A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.

Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and placed a mass of weight C and a mass of weight D on the right pan.

Print Left if the balance scale tips to the left; print Balanced if it balances; print Right if it tips to the right.

Constraints

1\leq A,B,C,D \leq 10

All input values are integers.

Input

Input is given from Standard Input in the following format:

A B C D

Output

Print Left if the balance scale tips to the left; print Balanced if it balances; print Right if it tips to the right.

Sample Input 1

3 8 7 1

Sample Output 1

Left

The total weight of the masses on the left pan is 11, and the total weight of the masses on the right pan is 8. Since 11>8, we should print Left.

Sample Input 2

3 4 5 2

Sample Output 2

Balanced

The total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.

Sample Input 3

1 7 6 4

Sample Output 3

Right

The total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.

Solution in C (Clang 10.0.0) (judge verdict: Wrong Answer)

#include<stdio.h>
int main(void) {
    int N;
    int A, B;
    int sum1, sum10, sum100, sum1000; //一の位, 十の位, 百の位, 千の位
    int sumN = 0; //各桁の和
    int sum = 0; //総和

    scanf("%d %d %d", &N, &A, &B);

    for (int n = 1; n <= N; n++) {
        if (1 <= n && n < 10) {
            sum1 = n;
            sumN = sum1;
        }
        else if (10 <= n && n < 100) {
            sum10 = n / 10;
            sum1 = n - sum10 * 10;
            sumN = sum10 + sum1;
        }
        else if (100 <= n && n < 1000) {
            sum100 = n / 100;
            sum10 = (n - sum100 * 100) / 10;
            sum1 = (n - sum100 * 100) - sum10 * 10;
            sumN = sum100 + sum10 + sum1;
        }
        else if (1000 <= n && n < 10000) {
            sum1000 = n / 1000;
            sum100 = (n - sum1000 * 1000) / 100;
            sum10 = ((n - sum1000 * 1000) - sum100 * 100) / 10;
            sum1 = ((n - sum1000 * 1000) - sum100 * 100) - sum10 * 10;
            sumN = sum1000 + sum100 + sum10 + sum1;
        }
        if (A <= sumN && sumN <= B) {
            sum += n;
        }
        sum1 = 0;
        sum10 = 0;
        sum100 = 0;
        sum1000 = 0;
    }
    printf("%d", sum);
    return 0;
}