#include <bits/stdc++.h>
using namespace std;
int func(int t, int b) {
  int ret = 0;
  while (t > 0 && b > 0) {
    if (t >= b) {
      ret += t / b;
      t %= b;
    } else {
      ret += (b - 1) / t;
      b -= (b - 1) / t * t;
    }
  }
  if (t == 0 && b == 1) return ret;
  return -1;
}
int func2(int t, int b, vector<char>& buf) {
  buf.clear();
  while (t > 0 && b > 0) {
    if (t >= b) {
      buf.push_back('T');
      t -= b;
    } else {
      buf.push_back('B');
      b -= t;
    }
  }
  reverse(buf.begin(), buf.end());
  int mistake = 0;
  int len = buf.size();
  for (int i = 0; i < (int)len - 1; i++)
    if (buf[i] == buf[i + 1]) mistake++;
  if (buf[0] != 'T') mistake = (1 << 29);
  return mistake;
}
int main() {
  int n, r;
  cin >> n >> r;
  vector<char> vec;
  int x = -1, y = -1, best = (1 << 29);
  for (int i = 0; i < (int)r + 1; i++)
    if (func(i, r) == n) {
      int tmp = func2(i, r, vec);
      if (tmp < best) {
        best = tmp;
        x = i, y = r;
      }
    }
  for (int i = 0; i < (int)r; i++)
    if (func(r, i) == n) {
      int tmp = func2(r, i, vec);
      if (tmp < best) {
        best = tmp;
        x = r, y = i;
      }
    }
  if (best == (1 << 29))
    cout << "IMPOSSIBLE" << endl;
  else {
    func2(x, y, vec);
    cout << best << endl;
    for (int i = 0; i < (int)vec.size(); i++) cout << vec[i];
    cout << endl;
  }
  return 0;
}
