#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (a && b) {
    if (a >= b)
      a = a % b;
    else
      b = b % a;
  }
  return a | b;
}
void f(string &s, long long x, int ty) {
  string p = "";
  while (x) {
    p = char('0' + (x % 10)) + p;
    x /= 10;
  }
  s += p;
  s += 'A' + ty;
}
int main() {
  long long a, b;
  cin >> a >> b;
  string ans = "";
  while (a && b) {
    if (gcd(a, b) != 1) {
      cout << "Impossible" << endl;
      return 0;
    }
    if (a > b) {
      f(ans, a / b - (b == 1), 0);
      a = a % b;
    } else {
      f(ans, b / a - (a == 1), 1);
      b = b % a;
    }
  }
  cout << ans << endl;
  return 0;
}
