#include <bits/stdc++.h>
int n, r, cost, ans, sum, rec;
bool bo[1000010];
void swap(int &x, int &y) {
  x ^= y;
  y ^= x;
  x ^= y;
}
bool check(int a, int b) {
  sum = rec = 0;
  while (1) {
    if (a > b) swap(a, b);
    if (a == 1) {
      if (b == 1) break;
      sum += b - 1;
      rec += b - 2;
      break;
    }
    if (!(b % a)) return false;
    rec += b / a - 1;
    sum += b / a;
    b %= a;
  }
  if (sum != n - 1) return false;
  if (rec > cost) return false;
  cost = rec;
  return true;
}
void write() {
  printf("%d\n", cost);
  int a = ans, b = r, i;
  rec = 0;
  while (a != 1 || b != 1) {
    if (b > a) {
      bo[++rec] = true;
      b -= a;
    } else {
      bo[++rec] = false;
      a -= b;
    }
  }
  printf("T");
  if (!bo[rec])
    for (i = rec; i; i--) printf(bo[i] ? "T" : "B");
  else
    for (i = rec; i; i--) printf(bo[i] ? "B" : "T");
  printf("\n");
}
int main() {
  int i;
  scanf("%d%d", &n, &r);
  cost = 0x3FFFFFFF;
  for (i = r; i; i--)
    if (check(i, r)) ans = i;
  if (cost == 0x3FFFFFFF)
    printf("IMPOSSIBLE\n");
  else
    write();
}
