import java.util.*

data class Score(val midterm: Int, val final: Int, val makeup: Int) {

    val doesTakeMidtermAndFinal = this.midterm != -1 && this.final != -1

    fun getPerformance(): String {
        val total = this.midterm + this.final
        return when {
            !doesTakeMidtermAndFinal -> "F"
            total >= 80 -> "A"
            total >= 65 -> "B"
            total >= 50 -> "C"
            total >= 30 -> if (this.makeup >= 50) "C" else "D"
            else -> "F"
        }
    }
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val scores = mutableListOf<Score>()
    while (true) {
        val midterm = scanner.nextInt()
        val final = scanner.nextInt()
        val makeup = scanner.nextInt()
        if (midterm == -1 && final == -1 && makeup == -1) {
            break
        }
        scores.add(Score(midterm, final, makeup))
    }
    scores.forEach {
        println(it.getPerformance())
    }
}
