#include <bits/stdc++.h>
using namespace std;
int n, r, ans;
bool flag;
char tmp[1000000 + 5], eoor[1000000 + 5];
void solve(int t, int b) {
  int tmpans = 0, len = 0;
  if (t == 3 && b == 5)
    flag = true;
  else
    flag = false;
  while (t != b && b >= 0 && t >= 0) {
    if (t > b) {
      tmp[len] = 'T';
      len++;
      t -= b;
    } else {
      tmp[len] = 'B';
      len++;
      b -= t;
    }
  }
  while (len != n - 1 || b != 1) return;
  tmp[len] = 'T';
  for (register int i = 0; i <= len - 1; i++)
    if (tmp[i] == tmp[i + 1]) tmpans++;
  if (tmpans < ans) {
    ans = tmpans;
    for (register int i = 0; i <= len; i++) eoor[i] = tmp[len - i];
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> r;
  ans = 1000000 + 5;
  for (register int i = 1; i <= r; i++) {
    solve(i, r);
    solve(r, i);
  }
  if (ans != 1000000 + 5) {
    cout << ans << endl;
    for (register int i = 0; i <= n - 1; i++) cout << eoor[i];
  } else
    cout << "IMPOSSIBLE";
  return 0;
}
