#include <bits/stdc++.h>
using namespace std;
struct rr {
  int n, cc;
} ansrr;
int n, r;
int l;
int ansn;
int type;
int dl, dt;
char oo;
rr dfs(int top, int but) {
  rr ret;
  if (top % but == 0 || but % top == 0) {
    if (top == 1 && but == 1) {
      ret.n = 1;
      ret.cc = 0;
    } else if (top == 1) {
      ret.n = but;
      ret.cc = but - 2;
    } else if (but == 1) {
      ret.n = top;
      ret.cc = top - 1;
    } else {
      ret.n = 1 << 23;
      ret.cc = 1 << 23;
    }
  } else if (top > but) {
    int tt = top / but;
    ret = dfs(top % but, but);
    ret.n += tt;
    ret.cc += tt - 1;
  } else if (top < but) {
    int tt = but / top;
    ret = dfs(top, but % top);
    ret.n += tt;
    ret.cc += tt - 1;
  }
  return ret;
}
void output(int top, int but) {
  if (top % but == 0 || but % top == 0) {
    if (top == 1) {
      oo = 'B';
      cout << "T" + string(but - 1, oo);
    } else if (but == 1) {
      oo = 'T';
      cout << string(top, oo);
    }
  } else if (top > but) {
    int tt = top / but;
    output(top % but, but);
    if (oo == 'T') {
      oo = 'B';
      cout << string(tt, oo);
    } else {
      oo = 'T';
      cout << string(tt, oo);
    }
  } else if (top < but) {
    int tt = but / top;
    output(top, but % top);
    if (oo == 'T') {
      oo = 'B';
      cout << string(tt, oo);
    } else {
      oo = 'T';
      cout << string(tt, oo);
    }
  }
}
int main() {
  cin >> n >> r;
  ansn = 1 << 22;
  for (int i = 1; i <= r; i++) {
    dl = i;
    dt = 0;
    rr res = dfs(i, r);
    if (res.n == n && res.cc < ansn) {
      ansn = res.cc;
      ansrr = res;
      type = 0;
      l = i;
    }
    dt = 1;
    res = dfs(r, i);
    if (res.n == n && res.cc < ansn) {
      ansn = res.cc;
      ansrr = res;
      type = 1;
      l = i;
    }
  }
  if (ansn == 1 << 22) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  cout << ansn << endl;
  if (type == 0) {
    output(l, r);
  } else {
    output(r, l);
  }
  cout << endl;
}
