#include <bits/stdc++.h>
using namespace std;
int test(int a, int b, int n) {
  int step = 0;
  int total = 0;
  int ne;
  int cur;
  if (a < b) swap(a, b);
  while (a != 1 && b != 1) {
    ne = a % b;
    if (!ne) return 0x7fffffff;
    cur = (a - ne) / b;
    step += cur;
    ++total;
    a = ne;
    swap(a, b);
  }
  step += a - 1;
  if (step != n) return 0x7fffffff;
  return n - total - 1;
}
vector<int> res;
char at[] = {'T', 'B'};
void get(int a, int b) {
  const int ca = a, cb = b;
  int total = 0;
  int ne;
  int cnt;
  res.clear();
  int i;
  if (a < b) swap(a, b);
  res.push_back(1);
  while (a != 1 && b != 1) {
    ne = a % b;
    cnt = (a - ne) / b;
    for (i = 0; i < cnt; ++i) res.push_back(i == cnt - 1);
    a = ne;
    swap(a, b);
  }
  for (i = 1; i < a; ++i) res.push_back(i == a - 1);
  return;
}
int main() {
  int n, f;
  scanf("%d%d", &n, &f);
  res.reserve(n);
  if (n == f && n == 1) {
    printf("0\nT\n");
    return 0;
  }
  int resmin = n;
  int i;
  int ret;
  int ra;
  if (n <= f) {
    for (i = 1; (i << 1) < f; ++i) {
      ret = test(i, f - i, n - 2);
      if (ret < resmin) {
        resmin = ret;
        ra = i;
      }
    }
  }
  int cur = 0;
  if (resmin < n) {
    get(ra, f - ra);
    printf("%d\n", resmin);
    putchar('T');
    for (i = res.size() - 1; i >= 0; --i) putchar(at[cur ^= res[i]]);
    putchar('\n');
  } else
    puts("IMPOSSIBLE");
  return 0;
}
