#include <bits/stdc++.h>
using namespace std;
int n, r;
int cur = 0, cnt;
bool was = false;
int big = 100000000;
stack<int> res;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
pair<int, int> getPair(int a, int b) {
  int temp;
  while (a % b != 0) {
    temp = a;
    a = b;
    b = temp % b;
    cnt++;
  }
  return make_pair(a, b);
}
void getCnt(int a, int b) {
  if (a == 1 && b == 0) {
    cur = big;
  } else {
    if (!(a == 0 && b == 1)) {
      if (a == 1 || b == 1) {
        if (a == 1) {
          cnt += b;
          cur += b - 2;
          if (cnt != n) cur = big;
        } else {
          cnt += a;
          cur += a - 1;
          if (cnt != n) cur = big;
        }
      } else {
        if (a < b) {
          cnt += b / a;
          cur += b / a - 1;
          getCnt(a, b % a);
        } else {
          cnt += a / b;
          cur += a / b - 1;
          getCnt(a % b, b);
        }
      }
    } else {
      if (cnt != n) cur = big;
    }
  }
}
void getOutput(int a, int b) {
  if (!(a == 1 && b == 1)) {
    if (a < b) {
      for (int i = 0; i < min(b / a, b - 1); i++) {
        res.push(0);
      }
      b %= a;
      if (!(a == 1 && b == 0)) {
        getOutput(a, b);
      }
    } else {
      for (int i = 0; i < a / b; i++) {
        res.push(1);
      }
      a %= b;
      if (!(a == 1 && b == 1)) {
        getOutput(a, b);
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &r);
  int mini = 100000000;
  pair<int, int> p;
  for (int i = 1; i < r; i++) {
    if (gcd(r, i) == 1) {
      cur = 0;
      cnt = 0;
      getCnt(i, r);
      if (cur < mini) {
        mini = cur;
        p = make_pair(i, r);
      }
      cur = 0;
      cnt = 0;
      getCnt(r, i);
      if (cur < mini) {
        mini = cur;
        p = make_pair(r, i);
      }
    }
  }
  if (n == 1 && r == 1) {
    mini = 0;
    p = make_pair(1, 1);
  }
  if (mini == big) {
    printf("IMPOSSIBLE");
  } else {
    printf("%d\n", mini);
    printf("T");
    getOutput(p.first, p.second);
    while (!res.empty()) {
      int v = res.top();
      res.pop();
      if (v)
        printf("T");
      else
        printf("B");
    }
  }
  return 0;
}
