#include <bits/stdc++.h>
using namespace std;
int n, r, bot, top;
vector<int> res;
int RES, pres;
void solve(int a, int b) {
  int rr = 0, temp = a;
  long long res = 0;
  while (b != 0) {
    int t = b;
    rr += a / b;
    if (b != 1)
      res += max(0, a / b - 1);
    else
      res += max(0, a / b - 2);
    b = a % b;
    a = t;
  }
  if (a != 1) return;
  if (rr == n && res < RES) RES = res, pres = temp;
}
void print(int a, int b) {
  int r = 0;
  while (b != 0) {
    int t = b;
    if (b != 1) {
      for (int i = 1; i <= a / b; i++) res.push_back(r);
    } else {
      for (int i = 1; i <= a / b - 1; i++) res.push_back(r);
      res.push_back(1 - r);
    }
    b = a % b;
    a = t;
    r = 1 - r;
  }
  char s[2];
  if (*res.rbegin() == 0)
    s[0] = 'T', s[1] = 'B';
  else
    s[1] = 'T', s[0] = 'B';
  for (int i = (int)res.size() - 1; i >= 0; i--) printf("%c", s[res[i]]);
}
int main() {
  cin >> n >> r;
  RES = 1000000000;
  for (int t = 1; t <= r; t++) solve(t, r);
  if (RES == 1000000000) {
    cout << "IMPOSSIBLE";
    return 0;
  }
  cout << RES << endl;
  print(pres, r);
  return 0;
}
