#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int sz = s.size(), k = 0, pos, i;
  long long sum[2] = {};
  for (i = 0; i < sz; ++i)
    if (s[i] == '^') {
      pos = i;
      break;
    }
  for (i = 0; i < sz; ++i) {
    if (s[i] == '=') continue;
    if (s[i] == '^') {
      ++k;
      continue;
    }
    sum[k] += (long long)abs(pos - i) * (s[i] - '0');
  }
  if (sum[0] == sum[1])
    cout << "balance\n";
  else if (sum[0] > sum[1])
    cout << "left\n";
  else
    cout << "right\n";
}
