#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { long double a; cin >> a; if (a > 1) { cout << "B "; } else if (a < 1) { cout << "C "; } else { cout << "A 1" << endl; return 0; } for (long double i = 1;; i++) { if (a * i == floor(a * i)) { int ans = (a + 1) * i - 2; for (long double j = 0; j <= a * i; j++) { for (long double k = 0; k <= i; k++) { long double x1 = 0, y1 = 0; long double x2 = a * i, y2 = i; long double x3 = j, y3 = k; long double x4, y4; if (int(floor(j + k)) % 2 == 0) { x4 = j + 1, y4 = k - 1; } else { x4 = j + 1, y4 = k + 1; } long double s = (x1 - x2) * (y3 - y1) + (y1 - y2) * (x1 - x3); long double t = (x1 - x2) * (y4 - y1) + (y1 - y2) * (x1 - x4); long double s1 = (x3 - x4) * (y1 - y3) + (y3 - y4) * (x3 - x1); long double t1 = (x3 - x4) * (y2 - y3) + (y3 - y4) * (x3 - x2); if (s * t < 0 && s1 * t1 < 0) { ans++; } } } cout << ans << endl; return 0; } } }