#include <bits/stdc++.h>
using namespace std;
int N, R;
int result = INT_MAX;
char opt[] = "TB";
int turns;
int sLast;
char rChar[1000001];
int main() {
  int x, y;
  cin >> N >> R;
  if (N == 1 && R == 1) {
    cout << 0 << endl << 'T' << endl;
    return 0;
  }
  for (int i = 1; i < R; i++) {
    x = i;
    y = R;
    int *smaller, *larger;
    int mistakes = 0;
    int times = 0;
    int turn_over = 0;
    while (x > 0 && y > 0) {
      if (x > y) {
        larger = &x;
        smaller = &y;
      } else {
        larger = &y;
        smaller = &x;
      }
      mistakes += *larger / *smaller - 1;
      times += *larger / *smaller;
      turn_over++;
      *larger %= *smaller;
    }
    if (x + y == 1 && times == N) {
      mistakes--;
      turn_over++;
      if (mistakes < result) {
        result = mistakes;
        sLast = i;
        turns = turn_over;
      }
    }
  }
  if (result == INT_MAX) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << result << endl;
    if (turns & 1) {
      x = R;
      y = sLast;
    } else {
      x = sLast;
      y = R;
    }
    for (int i = N - 1; i > 0; i--) {
      if (x > y) {
        rChar[i] = 'T';
        x -= y;
      } else {
        rChar[i] = 'B';
        y -= x;
      }
    }
    rChar[0] = 'T';
    cout << rChar << endl;
  }
  return 0;
}
