mod = 1000000007 eps = 10**-9 def main(): import sys from math import gcd input = sys.stdin.readline a, b = input().split(".") a = int(a) * 1000 + int(b) g = gcd(a, 1000) upper = a // g lower = 1000 // g ans = upper - 1 + lower - 1 + (upper + lower) // 2 + abs(upper - lower) // 2 if (upper + lower) % 2 == 0: S = "A" else: if lower & 1: S = "B" else: S = "C" print(S, ans) if __name__ == '__main__': main()