#include <bits/stdc++.h>
using namespace std;
int n, r;
int main() {
  cin >> n >> r;
  int ans = 0, Max = -1, mark = false;
  for (int i = 1; i <= r; i++) {
    int t = i, b = r, num = 0, cnt = 0;
    while (t > 0 && b > 0) {
      bool flag = false;
      if (b > t) {
        int c = b / t - 1;
        num += c;
        b -= t * c;
        if (b > t) {
          b -= t;
          num++;
        }
        flag = true;
      } else {
        if (t > b) {
          int c = t / b - 1;
          num += c;
          t -= b * c;
          if (t > b) {
            t -= b;
            num++;
          }
        }
      }
      cnt++;
      if (t == b) {
        num++;
        t -= b;
        cnt++;
        if (b == r) cnt--;
        if (cnt > Max && (max(b, t) == 1 && min(b, t) == 0) && num == n) {
          if (!flag)
            mark = true;
          else
            mark = false;
          Max = cnt;
          ans = i;
        }
      }
    }
  }
  if (Max == -1) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  string s;
  int t = ans, b = r;
  if (mark) swap(b, t);
  while (t > 0 && b > 0) {
    if (t >= b) {
      t -= b;
      s += 'T';
    } else {
      b -= t;
      s += 'B';
    }
  }
  reverse(s.begin(), s.end());
  cout << n - Max << endl << s << endl;
  return 0;
}
