#include <bits/stdc++.h>
using namespace std;
char s[2] = {'T', 'B'};
inline int read() {
  int x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') positive = 0;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
int N, R, S;
int work(int x, int y) {
  int ans = 0;
  if (x == 0 && y == 1) return ans;
  if (x == 0) return 1 << 30;
  ans = work(y % x, x) + y / x - 1;
  S += y / x;
  return ans;
}
int Print(int x, int y) {
  if (x == 0 && y == 1) return 0;
  int k = Print(y % x, x) ^ 1;
  if (y % x != 0) {
    for (int i = 1; i <= y / x; ++i) printf("%c", s[k]);
  } else {
    printf("T");
    for (int i = 1; i < y / x; ++i) printf("%c", s[k]);
  }
  return k;
}
int main() {
  N = read();
  R = read();
  int ans = 999999999, p;
  if (N == 1 && R == 1) {
    printf("0\n");
    printf("T\n");
    return 0;
  }
  for (int i = 1; i < R; ++i) {
    S = 0;
    int now = work(i, R);
    if (S != N) continue;
    if (now < ans) {
      ans = now;
      p = i;
    }
  }
  if (ans == 999999999)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", ans - 1);
    Print(p, R);
    printf("\n");
  }
  return 0;
}
