#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > sol;
void escribe() {
  for (int i = 0; i < int(sol.size()); i++)
    cout << sol[i].first << char(sol[i].second + 'A');
  cout << endl;
}
void genera(long long int a, long long int b) {
  if (a % b == 0) {
    sol.push_back(pair<long long int, long long int>(a / b - 1, 0));
    if (b == 1)
      escribe();
    else
      cout << "Impossible" << endl;
    exit(0);
  }
  if (b % a == 0) {
    sol.push_back(pair<long long int, long long int>(b / a - 1, 1));
    if (a == 1)
      escribe();
    else
      cout << "Impossible" << endl;
    exit(0);
  }
  if (a > b) {
    sol.push_back(pair<long long int, long long int>(a / b, 0));
    genera(a % b, b);
  } else {
    sol.push_back(pair<long long int, long long int>(b / a, 1));
    genera(a, b % a);
  }
}
int main() {
  long long int a, b;
  cin >> a >> b;
  genera(a, b);
}
