'use strict'

const main = arg => {
    var input = arg.trim().split("\n");
    const lastIndex = input.indexOf("-1 -1 -1");
    input = input.filter((a, i) => i < lastIndex);
    const result = [];

    const scoreCheck = (scores) => {
        if(scores[0] === -1 || scores[1] === -1){ return "F"; }
        const mAndf = scores[0] + scores[1];
        if(mAndf >= 80){
            return "A";
        } else if(80 > mAndf && mAndf >= 65){
            return "B";
        } else if( (65 > mAndf && mAndf >= 50) || (scores[2] >= 50)){
            return "C";
        } else if(50 > mAndf && mAndf >= 30){
            return "D";
        }

        return "F";
    }

    input.forEach(obj => {
        const nums = obj.split(" ").map(str => parseInt(str, 10));
        result.push(scoreCheck(nums));
    });

    console.log(result.join("\n"));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
