#include using namespace std; int gcd(int a, int b){ if (b == 0){ return a; } else { return gcd(b, a % b); } } int main(){ string a; cin >> a; a.erase(a.end() - 4); int num = stoi(a); int den = 1000; int g = gcd(num, den); int y = num / g; int x = den / g; if ((x + y) % 2 == 0){ cout << 'A'; } else if (x % 2 == 1){ cout << 'B'; } else { cout << 'C'; } cout << ' '; cout << (x - 1) + (y - 1) + (x + y) / 2 + abs(x - y) / 2 << endl; }