#include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; double A; cin >> A; int b = A*1000+0.01; int a = 1000; int g = gcd(a, b); a /= g; b /= g; // cout << a << ' ' << b << endl; char ans; if(b%2 == 0){ if(a%2 == 0) ans = 'A'; else ans = 'B'; }else{ if(a%2 == 0) ans = 'C'; else ans = 'A'; } int cnt = 0; if(a == b){ cnt = 1; }else{ if(a < b) swap(a, b); cnt = a+b-2+(a+b)/2+(a-b)/2; } cout << (char)ans << ' ' << cnt << endl; }