import scala.io.StdIn.readLine

object Main extends App {

  val lines = Iterator.continually(readLine())
  val scores = {
    val xs = for {
      line          <- lines
      Array(m, f, r) = line.split(" ").map { _.toInt }
    } yield (m, f, r)

    xs.takeWhile { _ != (-1, -1, -1) }
  }

  val results = scores.map(solve)

  results.foreach(println)

  def solve(score: (Int, Int, Int)): String = score match {
    case (-1, _, _) | (_, -1, _) => "F"
    case (m, f, r)               =>
      val s = m + f
      if (s >= 80) "A"
      else if (s >= 65) "B"
      else if (s >= 50) "C"
      else if (s >= 30) if (r >= 50) "C" else "D"
      else "F"
  }
}

