#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60000000")
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
double const pi = 3.1415926535897932384626433832795;
int const inf = (int)1e9;
long long const inf64 = (long long)4e18;
const string name = "b";
int n, x, err;
string ans;
char now[1000100];
void solve(int x, int y) {
  int sum = 0, yl = 0;
  while (1) {
    if (x == 0 && y == 1) break;
    if (x == 0 || y == 0) return;
    if (x >= y) {
      x -= y;
      if (yl > 0 && now[yl - 1] == 'T') sum++;
      now[yl++] = 'T';
    } else {
      y -= x;
      if (yl > 0 && now[yl - 1] == 'B') sum++;
      now[yl++] = 'B';
    }
  }
  if (yl != n || now[yl - 1] == 'B') return;
  now[yl] = '\0';
  if (err > sum) err = sum, ans = now;
}
int main() {
  cin >> n >> x;
  err = inf;
  ans = "";
  for (int i = 0; i < (int)x + 1; i++) {
    solve(i, x);
    solve(x, i);
  }
  reverse(ans.begin(), ans.end());
  if (err == inf)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << err << endl << ans.data() << endl;
  return 0;
}
