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 Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		// ouput:1以上 N以下の整数のうち、各桁の和が A 以上 B 以下であるものの総和
		
		//input:
			//整数N
			//整数A
			//整数B
		
		//logic
		//approach1
		//文字列としてのNについて、各桁をそれぞれ「数字に変換」
		//A,Bは「数字」として変換
		
		//input
		int N=0;
		int A=0,B=0;
		int digit_sum = 0;
		int sum = 0;
		
		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();
		
		A = scan.nextInt();
		B = scan.nextInt();
		
		//check
		if(A > 36 || B > 36) return;
		if(A < 1 || B < 1) return;	
		if(N > 10000 || N < 1) return;
		
		//logic
		for(int i=1;i<N+1;i++) {
			String s_N = String.valueOf(i);
			
			for (int j = 0; j < s_N.length() ;j++) {
				//各桁の和
				int tmp = Character.getNumericValue(s_N.charAt(j));
				digit_sum = digit_sum + tmp;
				
				
			}
			if(digit_sum >= A && digit_sum <= B) sum = sum + i;
			//リセット
			digit_sum = 0;
		}
		
		System.out.println(sum);
	}

}