#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e6 + 5;
int n, r;
int min_error = SIZE;
char cur[SIZE], res[SIZE];
void go(int a, int b) {
  int cnt = 0;
  while (a && b && cnt <= n) {
    if (a >= b) {
      cur[cnt++] = 'T';
      a -= b;
    } else {
      cur[cnt++] = 'B';
      b -= a;
    }
  }
  cur[cnt] = 0;
  if (a == 0 && b == 1 && cnt == n) {
    int error = 0;
    for (int i = 1; i < cnt; ++i)
      if (cur[i] == cur[i - 1]) ++error;
    if (error < min_error) {
      min_error = error;
      memcpy(res, cur, cnt + 1);
    }
  }
}
int main() {
  cin >> n >> r;
  for (int prv = 1; prv <= r; ++prv) {
    go(prv, r);
    go(r, prv);
  }
  if (min_error == SIZE)
    cout << "IMPOSSIBLE";
  else {
    cout << min_error << endl;
    reverse(res, res + n);
    cout << res;
  }
  return 0;
}
