def grade(m, f, r)
	return 'F' if m == -1 or f == -1

	m_f = m + f

	return case
	when 80 <= m_f; 'A'
	when 65 <= m_f; 'B'
	when 50 <= m_f; 'C'
	when 30 <= m_f; 50 <= r ? 'C' : 'D'
	else 'F'
	end
end

$<.each_line do |line|
	m, f, r = line.split.map(&:to_i)
	break if m == -1 and f == -1 and r == -1

	puts grade(m, f, r)
end