'use strict';
(function(stdin) {
  var lines = stdin.toString();
  var result = (function(data) {
    return data
      .map(function(v){return v.split(' ').map(Number)})
      .map(grade).join('\n');

    function grade(v) {
      var scoresum = v[0] + v[1];
      var absence  = v[0] * v[1] < 0;
      var retake = v[2];
      switch(true) {
        case absence || scoresum < 30 : return 'F';
        case scoresum >= 80 : return 'A';
        case scoresum >= 65 : return 'B';
        case scoresum >= 50 || retake >= 50 : return 'C';
        default : return 'D';
      }        
    }
  }(
    lines.split('-1 -1 -1')[0].trim().split('\n')
    ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));