#include <bits/stdc++.h>
int n, m, ans, ansy;
char s[2000000];
int main() {
  scanf("%d%d", &n, &m);
  if (n == 1 && m == 1) {
    printf("0\nT\n");
    return 0;
  }
  ans = 1 << 30;
  for (int i = 1; i < m; ++i) {
    int x = m, y = i, t = 0, p = 0;
    while (x && y)
      if (x > y) {
        t += x / y - 1, p += x / y;
        x %= y;
      } else {
        t += y / x - 1, p += y / x;
        y %= x;
      }
    if (x + y == 1 && p == n) {
      if (t - 1 < ans) {
        ansy = i, ans = t - 1;
      }
    }
  }
  if (ans == 1 << 30)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", ans);
    int x = m, y = ansy;
    for (int i = n; i; --i) {
      if (x > y) {
        x -= y;
        s[i] = 'T';
      } else {
        y -= x;
        s[i] = 'B';
      }
    }
    if (s[2] == 'T') {
      x = ansy, y = m;
      for (int i = n; i; --i) {
        if (x > y) {
          x -= y;
          s[i] = 'T';
        } else {
          y -= x;
          s[i] = 'B';
        }
      }
    }
    s[1] = 'T';
    printf("%s\n", s + 1);
  }
  return 0;
}
