fun main(args: Array<String>) {
    var (m, f, r) = readLine()!!.split(" ").map { it.toInt() }
    while (m != -1 || f != -1 || r != -1) {
        if (m != -1 && f != -1) {
            when {
                m + f in 80..100 -> println("A")
                m + f in 65..79 -> println("B")
                m + f in 50..64 -> println("C")
                m + f in 30..49 -> {
                    if (r >= 50) {
                        println("C")
                    } else {
                        println("D")
                    }
                }
                m + f in 0..29 -> println("F")
            }
        } else {
            println("F")
        }
        val (m2, f2, r2) = readLine()!!.split(" ").map { it.toInt() }
        m = m2
        f = f2
        r = r2
    }
}
