#include <bits/stdc++.h>
using namespace std;
int a[2];
struct data {
  int cnt;
  int d;
  data() {}
  data(int a, int b) : cnt(a), d(b) {}
};
vector<data> ans;
vector<data> ANS;
string xx = "TB";
string oo = "BT";
char A;
int main() {
  int r, n;
  int cnt, d;
  scanf("%d %d", &n, &r);
  int nn = 0;
  bool notans = true;
  int aa;
  bool imp = false;
  int aaa = 1000000000;
  if (r == 1 && n == 1) {
    printf("0\nT");
    return 0;
  }
  for (int i = 1; i < r; ++i) {
    a[0] = i;
    a[1] = r;
    ans.clear();
    nn = 0;
    aa = 0;
    while (nn < n) {
      if (a[0] < a[1]) {
        cnt = a[1] / a[0];
        d = 1;
        a[1] = a[1] % a[0];
      } else {
        cnt = a[0] / a[1];
        d = 0;
        a[0] = a[0] % a[1];
      }
      aa += cnt - 1;
      ans.push_back(data(cnt, d));
      nn += cnt;
      if (a[0] == 0) {
        if (a[1] == 1) {
          if (nn == n) {
            notans = false;
            if (aa < aaa) {
              aaa = aa;
              ANS = ans;
              ANS[ans.size() - 1].cnt--;
              int x = ans[ans.size() - 1].d ^ 1;
              ANS.push_back(data(1, x));
              A = 'o';
            }
          }
        }
        break;
      } else if (a[1] == 0) {
        if (a[0] == 1) {
          if (nn == n) {
            notans = false;
            if (aa < aaa) {
              aaa = aa;
              ANS = ans;
              ANS[ans.size() - 1].cnt--;
              int x = ans[ans.size() - 1].d ^ 1;
              ANS.push_back(data(1, x));
              A = 'x';
            }
          }
        }
        break;
      }
    }
  }
  if (notans)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", --aaa);
    if (A == 'x') {
      for (int i = ANS.size() - 1; i >= 0; --i) {
        for (int j = 0; j < ANS[i].cnt; ++j) printf("%c", xx[ANS[i].d]);
      }
    } else {
      for (int i = ANS.size() - 1; i >= 0; --i) {
        for (int j = 0; j < ANS[i].cnt; ++j) printf("%c", oo[ANS[i].d]);
      }
    }
  }
  return 0;
}
