fun main(args: Array<String>) {
    while (true) {
        val inStr = readLine() ?: return
        val scores = inStr.split(' ').map { e -> e.toInt() }
        if (scores.all { s -> s == -1 }) {
            // input ends
            return
        }

        val (m, f, r) = scores
        println(judgeGrade(m, f, r))
    }
}

fun judgeGrade(m: Int, f: Int, r: Int): String {
    if (m == -1) {
        return "F"
    }
    if (f == -1) {
        return "F"
    }

    val totalScore = m + f

    return when {
        totalScore >= 80 -> "A"
        totalScore >= 65 -> "B"
        totalScore >= 50 -> "C"
        totalScore >= 30 -> {
            when (r >= 50) {
                true -> "C"
                false -> "D"
            }
        }
        else -> "F"
    }
}

