#include using namespace std; double a; int n; int gcd(int p, int q) { if (q == 0) return p; return gcd(q, p % q); } int main() { cin >> a; a *= 1000; n = (int)a; int g = gcd(n, 1000); n /= g; int d = 1000 / g; if ((n + d) % 2 == 0) cout << "A "; else if (d % 2 == 1) cout << "B "; else cout << "C "; cout << n + d + max(n, d) - 3 + max(n, d) % 2 << endl; }