#!/usr/bin/env ruby

points = Array.new(3,0)
grades = Array.new
while true do
    points = gets.split.map(&:to_i)
    break if points[0] == -1 and points[1] == -1 and points[2] == -1
    if points[0] == -1 or points[1] == -1 then
        grades << "F"
    else
        case points[0] + points[1]
        when 80..100 then
            grades << "A"
        when 65..79 then
            grades << "B"
        when 50..64 then
            grades << "C"
        when 30..49 then
            if points[2] >= 50 then
                grades << "C"
            else
                grades << "D"
            end
        when 0..29 then
            grades << "F"
        end
    end
end

puts grades
