a,b=input().split(".") x=1000 y=int(a+b) from math import gcd g=gcd(x,y) x//=g y//=g c=x-1+y-1 if x==y: print("A",1) exit() for i in range(x+y+1): if y>x: c+=0<(2*i+1)*x(2*i+1)*x>x*(y-x) c+=0>(-(2*i+1))*x>x*(y-x) c+=0<(2*i+1)*x