#include <bits/stdc++.h>
using namespace std;
const int INF = 10;
const int MAX = 200047;
const int MAXD = 100047;
long long a, b;
string s = "";
long long nsd(long long a, long long b) {
  if (!a || !b) return a + b;
  return nsd(b % a, a);
}
void nsdq(long long a, long long b) {
  if (!a || !b) return;
  long long k1 = 0, k2 = 0, t;
  string ss = "";
  if (a > b) {
    k1 = a / b;
    ss += 'A';
    t = k1;
    if (b * k1 == a) t--;
  } else {
    k2 = b / a;
    ss += 'B';
    t = k2;
    if (b == a * k2) t--;
  }
  while (t) {
    ss += char('0' + t % 10);
    t /= 10;
  }
  reverse(ss.begin(), ss.end());
  s += ss;
  nsdq(a - k1 * b, b - k2 * a);
}
int main() {
  cin >> a >> b;
  if (nsd(a, b) != 1) {
    cout << "Impossible\n";
    return 0;
  }
  nsdq(a, b);
  cout << s;
  return 0;
}
