#include <bits/stdc++.h>
using namespace std;
int sp, st[1010101], r, n, err, ret = -1000000000, x, y, s1[1010101],
                                s2[1010101], i, ndec, fla, kk, st2[1010101],
                                sp2, j;
char line[1010101], ans[1010101], ch;
int main(int argc, char* const argv[]) {
  scanf("%d%d", &r, &n);
  for (i = 1; i <= n; i++) {
    x = i, y = n - i;
    sp = ndec = kk = 0;
    while (x && y) {
      if (x > y) {
        ndec = x / y;
        if (x % y == 0 && ndec > 1) --ndec;
        sp += ndec;
        x = x - ndec * y;
      } else {
        ndec = y / x;
        if (y % x == 0 && ndec > 1) --ndec;
        sp += ndec;
        y = y - ndec * x;
      }
      st[++kk] = ndec;
    }
    if (sp == r - 1 && (x < 2) && (y < 2)) {
      fla = 1;
      if (ret < kk) {
        ret = kk;
        for (j = 1; j <= kk; j++) st2[j] = st[j];
        sp2 = kk;
      }
    }
  }
  if (!fla)
    puts("IMPOSSIBLE");
  else {
    printf("%d\n", r - ret - 1);
    ch = 'B';
    for (i = sp2; i; i--) {
      if (ch == 'B')
        ch = 'T';
      else
        ch = 'B';
      for (j = 0; j < st2[i]; j++) putchar(ch);
    }
    if (ch == 'B')
      ch = 'T';
    else
      ch = 'B';
    putchar(ch);
    puts("");
  }
  return 0;
}
