#include <bits/stdc++.h>
char bar[1000002];
int main() {
  scanf("%s", bar);
  int n = strlen(bar);
  long long int left = 0, mid = 0, right = 0;
  for (int i = 0; bar[i] != '^'; i++) mid = i + 1;
  for (int i = 0; bar[i] != '^'; i++)
    if (bar[i] != '=') left += (mid - i) * (bar[i] - '0');
  for (int i = n - 1; bar[i] != '^'; i--)
    if (bar[i] != '=') right += (i - mid) * (bar[i] - '0');
  if (left < right) puts("right");
  if (right < left) puts("left");
  if (right == left) puts("balance");
  return 0;
}
