#include <bits/stdc++.h>
using namespace std;
void rprint(char c, int t) {
  while (t--) printf("%c", c);
}
void go(int T, int B, int& len, int& same) {
  if (T == 0) {
    same = (B == 1 ? -1 : 1234567);
    len = 0;
    return;
  }
  go(B % T, T, len, same);
  len += B / T;
  same += B / T - 1;
}
int print(int T, int B) {
  if (B % T == 0) {
    printf("T");
    rprint('B', B / T - 1);
    return 0;
  }
  int r = print(B % T, T);
  rprint("TB"[r], B / T);
  return 1 ^ r;
}
int main() {
  int n, W;
  cin >> n >> W;
  if (n == 1 && W == 1) {
    printf("0\nT\n");
    return 0;
  }
  int ansI = -1, ans = 1234567;
  int len, same;
  for (int i = 1; i < W; ++i) {
    go(i, W, len, same);
    if (len == n) {
      if (same < ans) {
        ans = same;
        ansI = i;
      }
    }
  }
  if (ans == 1234567)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", ans);
    print(ansI, W);
    printf("\n");
  }
  return 0;
}
