#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1000000;
char s[MAXN + 10] = {'T'};
int main() {
  int n, r, ans = INF;
  scanf("%d%d", &n, &r);
  int A, B = r;
  for (int i = 1; i <= r; i++) {
    int a = i, b = r, ret = 0, t, op = 0;
    while (a) {
      if (a == 1 && b > 1)
        ret += b - 2;
      else
        ret += b / a - 1;
      op += b / a;
      t = b % a;
      b = a;
      a = t;
    }
    if (b == 1 && op == n && ret < ans) A = i, ans = ret;
  }
  if (ans == INF)
    printf("IMPOSSIBLE");
  else {
    printf("%d\n", ans);
    for (int i = n - 1; i >= 1; i--) {
      if (B > A) {
        B -= A;
        s[i] = 'T';
      } else if (A > B) {
        A -= B;
        s[i] = 'B';
      }
    }
    if (s[1] == 'T')
      for (int i = 1; i < n; i++) s[i] = (s[i] == 'T' ? 'B' : 'T');
    printf("%s", s);
  }
}
