#include <bits/stdc++.h>
using namespace std;
string str(long long s) {
  string x;
  while (s > 0) {
    x += s % 10 + '0';
    s /= 10;
  }
  reverse(x.begin(), x.end());
  return x;
}
int main() {
  long long a, b;
  cin >> a >> b;
  int p = 0;
  if (b > a) {
    swap(a, b);
    p = 1;
  }
  string x;
  while (b > 1 && a / b > 0) {
    x += str(a / b);
    if (p == 0)
      x += 'A';
    else
      x += 'B';
    a %= b;
    swap(a, b);
    p = 1 - p;
  }
  x += str(a - 1);
  if (p == 0)
    x += 'A';
  else
    x += 'B';
  if (b == 1)
    cout << x << endl;
  else
    cout << "Impossible" << endl;
  return 0;
}
