#include <bits/stdc++.h>
using namespace std;
int N, R;
int best, cnt[1100], len;
int cur[1100];
char sym[] = "TB";
void check(int m) {
  int x[2], n = 0;
  int c = 0;
  x[0] = R;
  x[1] = m;
  while (x[1 - n % 2] > 1) {
    cur[n] = x[n % 2] / x[1 - n % 2];
    c += cur[n] - 1;
    x[n % 2] %= x[1 - n % 2];
    n++;
  }
  if (x[1 - n % 2] != 1) return;
  cur[n] = x[n % 2] - 1;
  c += cur[n] - 1;
  n++;
  cur[n++] = 1;
  int tot = 0;
  for (int i = 0; i < n; i++) tot += cur[i];
  if (tot != N) return;
  if (c < best) {
    best = c;
    memcpy(cnt, cur, sizeof(int) * n);
    len = n;
    reverse(cnt, cnt + len);
  }
}
int main() {
  scanf("%d%d", &N, &R);
  int x[2] = {0, 1};
  best = 0x3f3f3f3f;
  if (N == 1 && R == 1) {
    puts("0");
    puts("T");
    return 0;
  }
  for (int i = 1; i < R; i++) check(i);
  if (best == 0x3f3f3f3f)
    puts("IMPOSSIBLE");
  else {
    printf("%d\n", best);
    for (int i = 0; i < len; i++) {
      for (int j = 0; j < cnt[i]; j++) putchar(sym[i % 2]);
    }
    puts("");
  }
  return 0;
}
