#include <bits/stdc++.h>
using namespace std;
vector<char> v;
int main() {
  int i, j, k;
  int a, b;
  int n, r;
  scanf("%d%d", &n, &r);
  if (n == 1 && r == 1) {
    printf("0\nT\n");
    return 0;
  }
  int ans = 1000000000, best;
  for (i = 1; i <= r; i++) {
    a = r;
    b = i;
    for (j = 0, k = 0; j < n;) {
      if (a < b) swap(a, b);
      if (!b) break;
      j += a / b;
      k += a / b - 1;
      a %= b;
      if (!a) k--;
    }
    if (a < b) swap(a, b);
    if (a == 1 && b == 0 && j == n)
      if (ans > k) {
        ans = k;
        best = i;
      }
  }
  a = r;
  b = best;
  if (ans == 1000000000) {
    printf("IMPOSSIBLE\n");
    return 0;
  }
  for (i = 0; i < n - 1; i++)
    if (a > b) {
      v.push_back('T');
      a -= b;
    } else {
      v.push_back('B');
      b -= a;
    }
  if (v[v.size() - 1] == 'T')
    v.push_back('B');
  else
    v.push_back('T');
  if (v[v.size() - 1] == 'B')
    for (i = 0; i < v.size(); i++)
      if (v[i] == 'T')
        v[i] = 'B';
      else
        v[i] = 'T';
  printf("%d\n", ans);
  for (i = v.size() - 1; i >= 0; i--) printf("%c", v[i]);
  printf("\n");
  int wqweeee;
  return 0;
}
