while true
    m, f, r = gets.chomp.split.map(&:to_i)
    break if m == -1 && f == -1 && r == -1

    grade = "F"
    if m == -1 || f == -1
        grade = "F"
    elsif m + f >= 80
        grade = "A"
    elsif m + f >= 65
        grade = "B"
    elsif m + f >= 50
        grade = "C"
    elsif m + f >= 30
        if r >= 50
            grade = "C"
        else
            grade = "D"
        end
    end
    puts grade
end