#include <bits/stdc++.h>
using namespace std;
int opers;
int errs;
int n, r;
int err_ans = 10000000;
int t_ans;
int b_ans;
int gcd(int t, int b) {
  if (t == 7 && b == 10) {
    if (0) cerr << "=============break==============\n";
  }
  if (t == 0) return b;
  if (b == 0) return 10000000;
  if (t % b == 0) {
    opers += t / b;
    errs += t / b - 1;
    return b;
  }
  if (b % t == 0) {
    opers += b / t;
    errs += max(b / t - 2, 0);
    return t;
  }
  if (b > t) {
    int op = b / t;
    errs += op - 1;
    opers += op;
    return gcd(t, b % t);
  }
  if (b <= t) {
    int op = t / b;
    errs += op - 1;
    opers += op;
    return gcd(t % b, b);
  }
}
void gen(int t, int b) {
  if (t == 0) return;
  if (t >= b) {
    gen(t - b, b);
    cout << "T";
  } else {
    gen(t, b - t);
    cout << "B";
  }
}
int main() {
  cin >> n >> r;
  if (0) cerr << "==================================================\n";
  if (0) cerr << "i\terrors\toperations\n";
  if (0) cerr << "==================================================\n";
  for (int i = 0; i <= r; i++) {
    errs = opers = 0;
    int gd = gcd(i, r);
    if (gd == 1 && opers == n && errs < err_ans) {
      err_ans = errs;
      t_ans = i;
      b_ans = r;
    }
    if (gd == 1)
      if (0) cerr << i << "\t" << errs << "\t" << opers << endl;
    errs = opers = 0;
    gd = gcd(r, i);
    if (gd == 1 && opers == n && errs < err_ans) {
      err_ans = errs;
      t_ans = r;
      b_ans = i;
    }
    if (gd == 1)
      if (0) cerr << "~" << i << "\t" << errs << "\t" << opers << endl;
  }
  if (err_ans == 10000000) {
    cout << "IMPOSSIBLE";
    return 0;
  }
  cout << err_ans << endl;
  if (0) cerr << t_ans << "\t" << b_ans << endl;
  gen(t_ans, b_ans);
}
