You have a description of a lever as string *s*. We'll represent the string length as record |*s*|, then the lever looks as a horizontal bar with weights of length |*s*| - 1 with exactly one pivot. We will assume that the bar is a segment on the *Ox* axis between points 0 and |*s*| - 1.

The decoding of the lever description is given below.
 -  If the *i*-th character of the string equals "^", that means that at coordinate *i* there is the pivot under the bar. -  If the *i*-th character of the string equals "=", that means that at coordinate *i* there is nothing lying on the bar. -  If the *i*-th character of the string equals digit *c* (1-9), that means that at coordinate *i* there is a weight of mass *c* on the bar. 
Your task is, given the lever description, print if it will be in balance or not. Assume that the bar doesn't weight anything. Assume that the bar initially is in balance then all weights are simultaneously put on it. After that the bar either tilts to the left, or tilts to the right, or is in balance.
The first line contains the lever description as a non-empty string *s* (3 ≤ |*s*| ≤ 10<sup class="upper-index">6</sup>), consisting of digits (1-9) and characters "^" and "=". It is guaranteed that the line contains exactly one character "^". It is guaranteed that the pivot of the lever isn't located in any end of the lever bar.

To solve the problem you may need 64-bit integer numbers. Please, do not forget to use them in your programs.
#include <bits/stdc++.h>
using namespace std;
#define iamtefu ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define ld long double
#define fl(i,n,a) for(int i=a; i<n; i++)
#define w(t) while(t--)
int main(){
	iamtefu;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		auto start_timer=chrono::high_resolution_clock::now();
	#endif
		string s; cin>>s;
		ll l=0;ll r=0;
		bool d=false;
		for (int i=0; i<s.size();i++){
			if (s[i]-'1'<9 && d==false){
				l+=s[i]-'1'+1;
			} else if (s[i]=='^'){
				d=true;
			} else if (s[i]-'1'<9 && d==true){
				r+=s[i]-'1'+1;
			}
		}
		if (l>r){
			cout<<"left\n";
		} else if (l<r){
			cout<<"right\n";
		} else {
			cout<<"balance\n";
		}
	#ifndef ONLINE_JUDGE
		auto stop_timer = chrono::high_resolution_clock::now();
		auto duration = chrono::duration_cast<chrono::nanoseconds>(stop_timer - start_timer);
		cerr << "Time taken : " << ((long double)duration.count())/((long double) 1e9) <<"s "<<endl;
	#endif
	return 0;
}