import sys input = sys.stdin.readline a=float(input()) a*=1000 a=int(a) ANS=0 x=0 y=0 up=0 while True: #print(x,y,up,ANS) if up==0: y^=1 x+=a if x>1000: q=x//1000 r=x%1000 up^=(q%2) if up==1: x=1000-r else: x=r if q%2==0: ANS+=q*2+2 else: ANS+=q*2+1 else: ANS+=2 else: y^=1 x-=a if x<0: q=x//1000 r=x%1000 up^=(q%2) if up==1: x=r else: x=1000-r if q%2==0: ANS+=abs(q)*2+2 else: ANS+=abs(q)*2+1 else: ANS+=2 if x==0: if y==0: print("A",ANS-1) break else: print("B",ANS-2) break elif x==1000: if y==0: print("C",ANS-2) break else: print("A",ANS-1) break