#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
vector<bool> s;
int n, r;
int main() {
  s.resize(1000 * 1000);
  cin >> n >> r;
  long long res = INF, x;
  for (int i = 0; i <= r; i++) {
    int moveNum = 0, wMove = 0, a = i, b = r;
    while (a != 0) {
      moveNum += b / a;
      wMove += b / a - 1;
      if (a == 1 && b != 1) wMove--;
      b %= a;
      swap(a, b);
    }
    if (b == 1 && moveNum == n && wMove < res) x = i, res = wMove;
  }
  if (res == INF)
    cout << "IMPOSSIBLE\n";
  else {
    for (int i = n - 1; i >= 0; i--)
      if (x < r) {
        s[i] = 1;
        r -= x;
      } else
        x -= r;
    cout << res << '\n';
    ios::sync_with_stdio(false);
    if (s[1]) {
      for (int i = 0; i < n; i++) cout << (s[i] ? 'B' : 'T');
    } else {
      cout << 'T';
      for (int i = 1; i < n; i++) cout << (s[i] ? 'T' : 'B');
    }
    cout << '\n';
  }
  return 0;
}
