#include <bits/stdc++.h>
using namespace std;
int n, s, num;
char ans[1000005];
void Check(int x, int y) {
  int p, t = 0;
  int k = 0;
  int ret = x;
  while (1) {
    if (x < y) {
      p = x;
      x = y;
      y = p;
    }
    if (x == y || y == 0) break;
    k++;
    t += x / y;
    x = x % y;
  }
  if (x != 1 || y != 0) return;
  if (t == n && s < k) {
    s = k;
    num = ret;
  }
}
int main() {
  int i, j, t, r;
  scanf("%d%d", &n, &r);
  if (n == 1 && r == 1) {
    printf("0\nT\n");
    return 0;
  }
  s = -100000000;
  for (i = 1; i < r; i++) {
    Check(i, r);
  }
  if (s == -100000000) {
    printf("IMPOSSIBLE\n");
    return 0;
  }
  printf("%d\n", n - s - 1);
  int x = num, y = r, up = 0;
  while (1) {
    if (x == 1 && y == 1) break;
    if (x < y) {
      ans[up++] = 'T';
      y -= x;
    } else {
      ans[up++] = 'B';
      x -= y;
    }
  }
  printf("T");
  for (i = up - 1; i >= 0; i--) {
    if (ans[up - 1] == 'B')
      printf("%c", ans[i]);
    else
      printf("%c", ans[i] == 'T' ? 'B' : 'T');
  }
  return 0;
}
