from math import gcd
y = int(round(1000*float(input())))
g = gcd(1000,y)
x,y = 1000//g,y//g
R = "A" if (x+y)%2==0 else "B" if x%2 else "C"
c = x+y-2+(x+y)//2+abs(x-y)//2
print(R,c)