#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
void cal(int a, int b, int &step, int &miss) {
  if (b == 1) {
    step += a;
    miss += a - 2;
    return;
  }
  cal(b, a % b, step, miss);
  step += a / b;
  miss += a / b - 1;
}
void print(int a, int b, bool &f) {
  if (b == 1) {
    f = 1;
    putchar('T');
    for (int i = 0; i < a / b - 1; i++) putchar('B');
    return;
  }
  print(b, a % b, f);
  f ^= 1;
  for (int i = 0; i < a / b; i++) {
    if (!f)
      putchar('T');
    else
      putchar('B');
  }
}
void gao(int n, int r) {
  int min = INF, id = -1;
  int step, miss;
  for (int i = r - 1; i >= 1; i--)
    if (gcd(r, i) == 1) {
      step = miss = 0;
      cal(r, i, step, miss);
      if (step == n && miss <= min) id = i, min = miss;
    }
  if (id == -1)
    printf("IMPOSSIBLE\n");
  else {
    bool f = 0;
    printf("%d\n", min);
    print(r, id, f);
    putchar('\n');
  }
}
int main() {
  int n, r;
  while (scanf("%d%d", &n, &r) != EOF) {
    if (n == 1 && r == 1)
      printf("0\nT\n");
    else
      gao(n, r);
  }
  return 0;
}
