using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1_7_A
{
    class Program
    {
        static void Main(string[] args)
        {
            Graduatiion graduatiion = new Graduatiion();
            List<string> studentGraduation = new List<string>();
            string[] studentList = new string[3];
            while (graduatiion.IsNoScore(studentList = Console.ReadLine().Split(' '))==false)
            {
                studentGraduation.Add(graduatiion.Graduate());
            }
            for (int i = 0; i < studentGraduation.Count; i++)
            {
                Console.WriteLine(studentGraduation[i]);
            }
        }
    }
    class Graduatiion
    {
        int _mid_term_test_score;
        int _final_term_test_score;
        int _re_test_score;
        int _noScore = -1;
        internal void GraduationRead(string[] studentList)
        {
            _mid_term_test_score = int.Parse(studentList[0]);
            _final_term_test_score = int.Parse(studentList[1]);
            _re_test_score = int.Parse(studentList[2]);
        }
        internal bool IsNoScore(string[] studentList)
        {
            GraduationRead(studentList);
            if (_mid_term_test_score == _noScore
                && _final_term_test_score == _noScore
                && _re_test_score == _noScore)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        internal string Graduate()
        {
            if (GraduateF() == true)
            {
                return "F";
            }
            else if (GraduateA() == true)
            {
                return "A";
            }
            else if(GraduateB() == true)
            {
                return "B";
            }
            else if(GraduateC() == true)
            {
                return "C";
            }
            else if(GraduateD() == true)
            {
                return "D";
            }
            else
            {
                throw new InvalidProgramException();
            }
        }
        internal bool GraduateA()
        {
            if (_mid_term_test_score + _final_term_test_score >= 80)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        internal bool GraduateB()
        {
            if (_mid_term_test_score + _final_term_test_score >= 65
            && _mid_term_test_score + _final_term_test_score < 80)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        internal bool GraduateC()
        {
            if (_mid_term_test_score + _final_term_test_score >= 50
               && _mid_term_test_score + _final_term_test_score < 65)
            {
                return true;
            }
            else if (_mid_term_test_score + _final_term_test_score >= 30
               && _mid_term_test_score + _final_term_test_score < 50
               && _re_test_score >= 50)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        internal bool GraduateD()
        {
            if (_mid_term_test_score + _final_term_test_score >= 30
               && _mid_term_test_score + _final_term_test_score < 50
               && _re_test_score < 50)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        internal bool GraduateF()
        {
            if (_mid_term_test_score + _final_term_test_score < 30
               || _mid_term_test_score == _noScore
               || _final_term_test_score == _noScore)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}



Measured memory_bytes: 15892