#include <bits/stdc++.h>
int main() {
  char in[1000001];
  long long int p1, p2, p3, piv, llen = 0, rlen = 0, lmass = 0, rmass = 0;
  long long int ltor = 0, rtor = 0;
  int i, f = 0;
  scanf("%s", &in);
  for (i = 0; in[i] != '\0'; i++) {
    if (in[i] == '^') {
      p2 = i;
    }
  }
  for (i = 0; in[i] != '\0'; i++) {
    if (in[i] - '0' >= 0 && in[i] - '0' <= 9 && f == 0) {
      p1 = i;
      llen = p2 - p1;
      lmass = in[i] - '0';
      ltor += llen * lmass;
    }
    if (in[i] == '^') {
      p2 = i;
      f = 1;
    }
    if (in[i] - '0' >= 0 && in[i] - '0' <= 9 && f == 1) {
      p3 = i;
      rlen = p3 - p2;
      rmass = in[i] - '0';
      rtor += rlen * rmass;
    }
  }
  if (ltor == rtor)
    printf("balance\n");
  else if (ltor > rtor)
    printf("left\n");
  else if (ltor < rtor)
    printf("right\n");
  return 0;
}
