import java.io.PrintWriter import java.util.* import kotlin.math.* fun gcd(a: Int, b: Int): Int { if (b == 0) return a val c = a % b return gcd(b, c) } fun PrintWriter.solve() { val s = nextLine() val n = s.replace(".", "").toInt() val d = gcd(n, 1000) val x = 1000 / d val y = n * x / 1000 val final = if ((x + y) % 2 == 0) 'A' else if (x % 2 == 0) 'C' else 'B' var count = x + y - 2 for (i in 1 until x + y step 2) { count++ } for (i in 1 until (x - y).absoluteValue step 2) { count++ } println("$final $count") } fun main() { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion