#include <bits/stdc++.h>
using namespace std;
char s[1000005];
char *s1, *s2;
long long su1, su2;
int main() {
  int l1, l2;
  while (scanf("%s", s) != EOF) {
    s1 = strtok(s, "^");
    s2 = strtok(NULL, "^");
    l1 = strlen(s1);
    l2 = strlen(s2);
    su1 = 0;
    su2 = 0;
    for (int i = 0; i < l1; i++) {
      if (isdigit(s1[i])) {
        su1 = su1 + (s1[i] - '0') * (l1 - i);
      }
    }
    for (int i = 0; i < l2; i++) {
      if (isdigit(s2[i])) {
        su2 = su2 + (s2[i] - '0') * (i + 1);
      }
    }
    if (su1 < su2) printf("right\n");
    if (su1 == su2) printf("balance\n");
    if (su1 > su2) printf("left\n");
  }
  return 0;
}
