from math import gcd from decimal import Decimal a = Decimal(input()) a1000 = int(1000 * a) g = gcd(1000, a1000) x = 1000 // g y = a1000 // g vertex = 'ABCA'[(x % 2) + (y % 2) * 2] edge = x + y - 2 + abs(x - y) // 2 + (x + y) // 2 print(vertex, edge)