#include <bits/stdc++.h>
using namespace std;
long long x, y;
string s, s2;
int main() {
  cin >> x >> y;
  while (x > 1 || y > 1) {
    if (x > y) {
      long long t = x / y;
      if (x - t * y < 1) t--;
      if (t == 0) {
        cout << "Impossible";
        return 0;
      }
      x = x - t * y;
      s2 = "";
      while (t > 0) {
        s2 = char((t % 10) + '0') + s2;
        t = t / 10;
      }
      s = s + s2 + 'A';
    } else {
      long long t = y / x;
      if (y - t * x < 1) t--;
      if (t == 0) {
        cout << "Impossible";
        return 0;
      }
      y = y - t * x;
      s2 = "";
      while (t > 0) {
        s2 = char((t % 10) + '0') + s2;
        t = t / 10;
      }
      s = s + s2 + 'B';
    }
  }
  cout << s;
}
