#include <bits/stdc++.h>
using namespace std;
int n, r, sum;
char s[] = {'T', 'B'};
int calc(int x, int y) {
  int tmp = 0;
  if (x == 0 && y == 1) return tmp;
  if (x == 0) return 1 << 30;
  tmp = calc(y % x, x) + y / x - 1;
  sum += y / x;
  return tmp;
}
int print(int x, int y) {
  if (x == 0 && y == 1) return 0;
  int id = print(y % x, x) ^ 1;
  if (y % x != 0)
    for (int i = 1; i <= y / x; ++i) printf("%c", s[id]);
  else {
    printf("T");
    for (int i = 1; i < y / x; ++i) printf("%c", s[id]);
  }
  return id;
}
int main() {
  int min = 1 << 30, id;
  scanf("%d%d", &n, &r);
  if (n == 1 && r == 1) {
    printf("0\n");
    printf("T\n");
    return 0;
  }
  for (int i = 1; i < r; ++i) {
    sum = 0;
    int tmp = calc(i, r);
    if (sum != n) continue;
    if (tmp < min) {
      min = tmp;
      id = i;
    }
  }
  if (min == (1 << 30))
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", min - 1);
    print(id, r);
    printf("\n");
  }
  return 0;
}
