#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
int dblcmp(double d) {
  if (fabs(d) < eps) return 0;
  return (d > 0) ? 1 : -1;
}
int n, m, T, r;
const int N = 1000100;
struct Me {
  int s[N][2];
  int cnt;
  int errorr, all;
  void clear() {
    cnt = 0;
    errorr = 0;
    all = 0;
  }
  void counterrorr() {
    errorr = 0;
    for (int i = 0; i < cnt; ++i) errorr += s[i][1] - 1;
  }
  bool operator<(const Me& A) const { return errorr < A.errorr; }
  bool gao(int f, int g) {
    cnt = 0;
    errorr = 0;
    all = 0;
    while (f && g) {
      if (f > g) {
        s[cnt][0] = 0;
        s[cnt][1] = f / g;
        if (f % g == 0) {
          s[cnt][1]--;
          f = g;
        } else
          f %= g;
        all += s[cnt++][1];
        if (all > n) return false;
      } else if (f < g) {
        s[cnt][0] = 1;
        s[cnt][1] = g / f;
        if (g % f == 0) {
          s[cnt][1]--;
          g = f;
        } else
          g %= f;
        all += s[cnt++][1];
        if (all > n) return false;
      } else {
        if (f * g != 1) return false;
        if (cnt == 0 || s[cnt - 1][0] == 0) {
          s[cnt][0] = 1;
          s[cnt][1] = g / f;
          g %= f;
          all += s[cnt++][1];
          if (all > n) return false;
        } else {
          s[cnt][0] = 0;
          s[cnt][1] = f / g;
          f %= g;
          all += s[cnt++][1];
          if (all > n) return false;
        }
      }
    }
    return all == n;
  }
} ans[2];
void solve() {
  ans[0].errorr = 99999999;
  int dt = 1;
  for (int i = 0; i <= r; ++i) {
    if (!ans[dt].gao(i, r)) continue;
    ans[dt].counterrorr();
    if (ans[dt] < ans[1 - dt]) dt = 1 - dt;
  }
  dt = 1 - dt;
  if (ans[dt].errorr == 99999999)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", ans[dt].errorr);
    int pre = ans[dt].s[0][0];
    for (int i = 0; i < ans[dt].cnt; ++i)
      for (int j = 0; j < ans[dt].s[i][1]; ++j)
        if (ans[dt].s[i][0] == pre)
          printf("T");
        else
          printf("B");
    printf("\n");
  }
}
int main() {
  while (cin >> n >> r) solve();
}
