#include <bits/stdc++.h>
using namespace std;
const int inf = ~0u >> 1, N = 1000005;
int n, r, x, ans, fr;
char o[N];
void output(int x, int y) {
  for (int i = n; i; --i)
    if (x >= y)
      o[i - 1] = 'T', x -= y;
    else
      o[i - 1] = 'B', y -= x;
}
int evaluate(int x, int y) {
  int sta = 0, stb = 0, t;
  while (x != 0 && y != 0 && sta <= n) {
    if (x > y) {
      if (x % y != 0) {
        t = x / y;
        sta += t;
        stb += t - 1;
        x %= y;
      } else {
        t = x / y - 1;
        sta += t;
        stb += t - 1;
        x = y;
        ++sta;
        y = 0;
      }
    } else {
      if (y % x != 0) {
        t = y / x;
        sta += t;
        stb += t - 1;
        y %= x;
      } else {
        t = y / x - 1;
        sta += t;
        stb += t - 1;
        y = x;
        ++sta;
        x = 0;
      }
    }
  }
  if (x == 0 && y == 1 && sta == n)
    return stb;
  else
    return -1;
}
void nrun() {
  ans = n;
  for (int i = 1; i < r; ++i) {
    x = evaluate(i, r);
    if (x != -1 && x <= ans) ans = x, fr = i;
    x = evaluate(r, i);
    if (x != -1 && x <= ans) ans = x, fr = -i;
  }
  if (ans == n)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", ans);
    if (fr > 0)
      output(fr, r);
    else
      output(r, -fr);
    puts(o);
  }
}
int main() {
  scanf("%d%d", &n, &r);
  if (r == 1) {
    printf(n == 1 ? "0\nT\n" : "IMPOSSIBLE\n");
  } else
    nrun();
  return 0;
}
