#include <bits/stdc++.h>
std::pair<long long, long long> target;
void init() { std::cin >> target.first >> target.second; }
std::vector<long long> cheng(long long x, long long y) {
  static long long digit[2][25];
  memset(digit, 0, sizeof(digit));
  for (int i = 0; i <= 20; i++) {
    digit[0][i] = x % 10;
    x /= 10;
    digit[1][i] = y % 10;
    y /= 10;
  }
  std::vector<long long> ret;
  ret.clear();
  ret.resize(55);
  for (int i = 0; i <= 20; i++) {
    for (int j = 0; j <= 20; j++) {
      ret[i + j] += digit[0][i] * digit[1][j];
    }
  }
  for (int i = 0; i < 50; i++) {
    ret[i + 1] += ret[i] / 10;
    ret[i] %= 10;
  }
  return ret;
}
bool cmp(const std::vector<long long> &x, const std::vector<long long> &y) {
  for (int i = 50; i >= 0; i--) {
    if (x[i] > y[i]) {
      return false;
    }
    if (x[i] < y[i]) {
      return true;
    }
  }
  return true;
}
bool on_left(std::pair<long long, long long> x,
             std::pair<long long, long long> y) {
  return cmp(cheng(x.first, y.second), cheng(x.second, y.first)) == true;
}
void work() {
  std::pair<long long, long long> a = std::make_pair(1LL, 0);
  std::pair<long long, long long> b = std::make_pair(0, 1LL);
  static std::vector<std::pair<long long, char> > ans;
  ans.clear();
  while (a.first + b.first <= target.first &&
         a.second + b.second <= target.second) {
    if (a.first + b.first == target.first &&
        a.second + b.second == target.second) {
      break;
    }
    std::pair<long long, long long> tmp =
        std::make_pair(a.first + b.first, a.second + b.second);
    if (on_left(target, tmp)) {
      long long low = 1;
      long long high = 1e18;
      if (b.first != 0) {
        high = std::min(high, (target.first - a.first - b.first) / b.first);
      }
      if (b.second != 0) {
        high = std::min(high, (target.second - a.second - b.second) / b.second);
      }
      long long cur = 0;
      while (low <= high) {
        long long mid = (low + high) >> 1;
        std::pair<long long, long long> tt =
            std::make_pair(a.first + mid * b.first, a.second + mid * b.second);
        if (on_left(target, tt)) {
          cur = std::max(cur, mid);
          low = mid + 1;
        } else {
          high = mid - 1;
        }
      }
      if (cur == 0) {
        break;
      }
      a.first += cur * b.first;
      a.second += cur * b.second;
      ans.push_back(std::make_pair(cur, 'B'));
    } else {
      long long low = 1;
      long long high = 1e18;
      if (a.first != 0) {
        high = std::min(high, (target.first - b.first - a.first) / a.first);
      }
      if (a.second != 0) {
        high = std::min(high, (target.second - b.second - a.second) / a.second);
      }
      long long cur = 0;
      while (low <= high) {
        long long mid = (low + high) >> 1;
        std::pair<long long, long long> tt =
            std::make_pair(b.first + mid * a.first, b.second + mid * a.second);
        if (on_left(tt, target)) {
          cur = std::max(cur, mid);
          low = mid + 1;
        } else {
          high = mid - 1;
        }
      }
      if (cur == 0) {
        break;
      }
      b.first += cur * a.first;
      b.second += cur * a.second;
      ans.push_back(std::make_pair(cur, 'A'));
    }
  }
  if (a.first + b.first == target.first &&
      a.second + b.second == target.second) {
    for (int i = 0; i < (int)ans.size(); i++) {
      printf("%I64d%c", ans[i].first, ans[i].second);
    }
    std::cout << std::endl;
  } else {
    puts("Impossible");
  }
}
int main() {
  init();
  work();
  return 0;
}
