#include <bits/stdc++.h>
using namespace std;
int n, r, i, ans = 1000000000;
const string im = "IMPOSSIBLE";
char s1[1111111], s0[1111111];
inline void check(int x, int y) {
  int l = 0;
  while (x != y) {
    if (x > y) {
      x -= y;
      s0[l] = 'T';
      l++;
    } else {
      y -= x;
      s0[l] = 'B';
      l++;
    }
  }
  if (l != n - 1) return;
  if (x + y != 2) return;
  s0[l] = 'T';
  int c = 0;
  for (int i = 1; i <= l; i++)
    if (s0[i] == s0[i - 1]) c++;
  if (c < ans) {
    for (int i = 0; i <= l; i++) s1[i] = s0[i];
    ans = c;
  }
}
int main() {
  cin >> n >> r;
  if (n == 1) {
    if (r == 1)
      cout << 0 << endl << "T" << endl;
    else
      cout << im << endl;
    return 0;
  }
  for (i = 1; i < r; i++) {
    check(i, r);
    check(r, i);
  }
  if (ans == 1000000000)
    cout << im << endl;
  else {
    cout << ans << endl;
    for (i = n - 1; i >= 0; i--) cout << s1[i];
    cout << endl;
  }
  return 0;
}
