#include <bits/stdc++.h>
using namespace std;
ifstream Cin("input.txt");
ofstream Cout("output.txt");
pair<bool, long long> Try(long long A, long long B, long long N) {
  long long err = 0, C;
  while (A > 0 && B > 0 && N > 0) {
    if (A == 1 && B != 1) {
      C = B - 1;
      A = B = 1;
    } else if (A >= B) {
      C = A / B;
      A %= B;
    } else {
      C = B / A;
      B %= A;
    }
    err += C - 1;
    N -= C;
  }
  return make_pair(N == 0 && A == 0 && B == 1, err);
}
string get(long long A, long long B, long long N) {
  string TMP;
  while (N) {
    N--;
    if (A >= B) {
      A -= B;
      TMP.push_back('T');
    } else {
      B -= A;
      TMP.push_back('B');
    }
  }
  reverse(TMP.begin(), TMP.end());
  return TMP;
}
int main() {
  long long n, r, i, A, B, ER = (long long)1e15;
  pair<bool, long long> Cur;
  cin >> n >> r;
  for (i = 1; i <= r; i++) {
    Cur = Try(i, r, n);
    if (Cur.first) {
      if (Cur.second < ER) {
        ER = Cur.second;
        A = i;
        B = r;
      }
    }
    Cur = Try(r, i, n);
    if (Cur.first) {
      if (Cur.second < ER) {
        ER = Cur.second;
        A = r;
        B = i;
      }
    }
  }
  if (ER == (long long)1e15)
    cout << "IMPOSSIBLE";
  else
    cout << ER << endl << get(A, B, n);
}
