from math import gcd a, b = map(int, input().split('.')) t = a * 1000 + b g = gcd(t, 1000) y = t // gcd(t, 1000) x = 1000 // gcd(t, 1000) c = x + y - 2 + (x + y) // 2 + abs(x - y) // 2 if (x + y) % 2 == 0: print('A', c) elif x % 2 == 0: print('C', c) else: print('B', c)