fun main(args: Array<String>) {
    while (true) {
        val (m, f, r) = readLine()!!.split(" ").map(String::toInt)

        if ((m == -1) and (f == -1) and (r == -1)) {
            break
        }

        if ((m == -1) or (f == -1)) {
            when {
                50 <= r -> println("C")
                else -> println("F")
            }
        } else {
            val totalScore = m + f
            when {
                80 <= totalScore -> println("A")
                (65 <= totalScore) and (totalScore < 80) -> println("B")
                (50 <= totalScore) and (totalScore < 65) -> println("C")
                (30 <= totalScore) and (totalScore < 50) -> if (50 <= r) {println("C")} else {println("D")}
                else -> println("F")
            }
        }
    }
}

