#include <bits/stdc++.h>
using namespace std;
int n, r;
int v[100], cnt, diff;
const int inf = 0x3fffffff;
int calc(int x, int y) {
  cnt = 0;
  int sum = 0;
  while (x) {
    if (y % x == 0) {
      if (y == 1)
        v[++cnt] = y / x;
      else if (x == 1)
        v[++cnt] = y / x - 1;
      else
        return inf;
    } else
      v[++cnt] = y / x;
    sum += v[cnt];
    int t = y - v[cnt] * x;
    y = x;
    x = t;
  }
  if (sum != n) return inf;
  diff = 0;
  for (int i = 1; i <= cnt; i++)
    if (v[i] != 1) diff += v[i] - 1;
  return diff;
}
int ans[100], ansc;
int main() {
  while (scanf("%d %d", &n, &r) != EOF) {
    if (r == 0) {
      if (n == 1)
        printf("0\nT\n");
      else
        puts("IMPOSSIBLE");
      continue;
    }
    int ret = inf;
    for (int i = 1; i <= r; i++) {
      int now = calc(i, r);
      if (ret > now) {
        ret = now;
        ansc = cnt;
        for (int j = 1; j <= cnt; j++) ans[j] = v[j];
      }
    }
    if (ret == inf)
      puts("IMPOSSIBLE");
    else {
      printf("%d\n", ret);
      char c = 'T';
      for (int i = ansc; i >= 1; i--) {
        while (ans[i]--) putchar(c);
        if (c == 'T')
          c = 'B';
        else
          c = 'T';
      }
      puts("");
    }
  }
  return 0;
}
