import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        int i, m, f, r, gou, flg = 0, cnt = 0;
	String seiseki;
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> mid = new ArrayList<Integer>(); //??????????¨?????????°??¨
	ArrayList<Integer> fin = new ArrayList<Integer>(); //???????????????????????°??¨
	ArrayList<Integer> rit = new ArrayList<Integer>(); //???????¨?????????°??¨
	ArrayList<Character> sei = new ArrayList<Character>(); //????????¨

	//??\?????????
	for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        }
	//??????????????????
        for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	}
	for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	}
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        int i, m, f, r, gou, flg = 0, cnt = 0;
	String seiseki;
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> mid = new ArrayList<Integer>(); //??????????¨?????????°??¨
	ArrayList<Integer> fin = new ArrayList<Integer>(); //???????????????????????°??¨
	ArrayList<Integer> rit = new ArrayList<Integer>(); //???????¨?????????°??¨
	ArrayList<Character> sei = new ArrayList<Character>(); //????????¨

	//??\?????????
	for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        }
	//??????????????????
        for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	}
	for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	}
    }
} Main public static void main(String[] args) {
        int i, m, f, r, gou, flg = 0, cnt = 0;
	String seiseki;
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> mid = new ArrayList<Integer>(); //??????????¨?????????°??¨
	ArrayList<Integer> fin = new ArrayList<Integer>(); //???????????????????????°??¨
	ArrayList<Integer> rit = new ArrayList<Integer>(); //???????¨?????????°??¨
	ArrayList<Character> sei = new ArrayList<Character>(); //????????¨

	//??\?????????
	for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        }
	//??????????????????
        for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	}
	for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	}
    } main {
        int i, m, f, r, gou, flg = 0, cnt = 0;
	String seiseki;
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> mid = new ArrayList<Integer>(); //??????????¨?????????°??¨
	ArrayList<Integer> fin = new ArrayList<Integer>(); //???????????????????????°??¨
	ArrayList<Integer> rit = new ArrayList<Integer>(); //???????¨?????????°??¨
	ArrayList<Character> sei = new ArrayList<Character>(); //????????¨

	//??\?????????
	for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        }
	//??????????????????
        for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	}
	for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	}
    } int i i m m f f r r gou gou flg = 0 flg 0 cnt = 0; cnt 0 String seiseki; seiseki Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> mid = new ArrayList<Integer>(); mid new ArrayList<Integer>() ArrayList<Integer> fin = new ArrayList<Integer>(); fin new ArrayList<Integer>() ArrayList<Integer> rit = new ArrayList<Integer>(); rit new ArrayList<Integer>() ArrayList<Character> sei = new ArrayList<Character>(); sei new ArrayList<Character>() for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        } i = 0; i = 0 i 0 flg == 0 flg 0 i++ i++ i {
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        } {
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        } m = sc.nextInt() m sc.nextInt() sc.nextInt sc mid.add(new Integer(m)) mid.add mid new Integer(m) f = sc.nextInt() f sc.nextInt() sc.nextInt sc fin.add(new Integer(f)) fin.add fin new Integer(f) r = sc.nextInt() r sc.nextInt() sc.nextInt sc rit.add(new Integer(r)) rit.add rit new Integer(r) cnt++ cnt if(m == -1 && f == -1 && r == -1)
		break; m == -1 && f == -1 && r == -1 m == -1 && f == -1 && r == -1 m == -1 m -1 1 f == -1 f -1 1 r == -1 r -1 1 break; for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	} i = 0; i = 0 i 0 cnt != i cnt i i++ i++ i {
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	} {
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	} gou = fin.get(new Integer(i)) + mid.get(new Integer(i)) gou fin.get(new Integer(i)) + mid.get(new Integer(i)) fin.get(new Integer(i)) fin.get fin new Integer(i) mid.get(new Integer(i)) mid.get mid new Integer(i) if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F'); fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1 fin.get(new Integer(i)) == -1 fin.get(new Integer(i)) fin.get fin new Integer(i) -1 1 mid.get(new Integer(i)) == -1 mid.get(new Integer(i)) mid.get mid new Integer(i) -1 1 sei.add('F') sei.add sei 'F' if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F'); gou >= 80 gou 80 sei.add('A') sei.add sei 'A' if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F'); gou >= 65 gou 65 sei.add('B') sei.add sei 'B' if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F'); gou >= 50 || rit.get(new Integer(i)) >= 50 gou >= 50 gou 50 rit.get(new Integer(i)) >= 50 rit.get(new Integer(i)) rit.get rit new Integer(i) 50 sei.add('C') sei.add sei 'C' if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F'); gou >= 30 gou 30 sei.add('D') sei.add sei 'D' sei.add('F') sei.add sei 'F' for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	} i = 0; i = 0 i 0 cnt - 1 != i cnt - 1 cnt 1 i i++ i++ i {
	    System.out.println(sei.get(new Integer(i)));
	} {
	    System.out.println(sei.get(new Integer(i)));
	} System.out.println(sei.get(new Integer(i))) System.out.println System.out System System.out sei.get(new Integer(i)) sei.get sei new Integer(i) String[] args args public class Main {
    public static void main(String[] args) {
        int i, m, f, r, gou, flg = 0, cnt = 0;
	String seiseki;
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> mid = new ArrayList<Integer>(); //??????????¨?????????°??¨
	ArrayList<Integer> fin = new ArrayList<Integer>(); //???????????????????????°??¨
	ArrayList<Integer> rit = new ArrayList<Integer>(); //???????¨?????????°??¨
	ArrayList<Character> sei = new ArrayList<Character>(); //????????¨

	//??\?????????
	for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        }
	//??????????????????
        for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	}
	for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	}
    }
} public class Main {
    public static void main(String[] args) {
        int i, m, f, r, gou, flg = 0, cnt = 0;
	String seiseki;
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> mid = new ArrayList<Integer>(); //??????????¨?????????°??¨
	ArrayList<Integer> fin = new ArrayList<Integer>(); //???????????????????????°??¨
	ArrayList<Integer> rit = new ArrayList<Integer>(); //???????¨?????????°??¨
	ArrayList<Character> sei = new ArrayList<Character>(); //????????¨

	//??\?????????
	for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        }
	//??????????????????
        for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	}
	for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	}
    }
} Main
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        int i, m, f, r, gou, flg = 0, cnt = 0;
	String seiseki;
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> mid = new ArrayList<Integer>(); //??????????¨?????????°??¨
	ArrayList<Integer> fin = new ArrayList<Integer>(); //???????????????????????°??¨
	ArrayList<Integer> rit = new ArrayList<Integer>(); //???????¨?????????°??¨
	ArrayList<Character> sei = new ArrayList<Character>(); //????????¨

	//??\?????????
	for(i = 0; flg == 0; i++){
       	    m = sc.nextInt();
       	    mid.add(new Integer(m));
       	    f = sc.nextInt();
	    fin.add(new Integer(f));
       	    r = sc.nextInt();
       	    rit.add(new Integer(r));
	    cnt++;
	    if(m == -1 && f == -1 && r == -1)
		break;
        }
	//??????????????????
        for(i = 0; cnt != i; i++){
	    gou = fin.get(new Integer(i)) + mid.get(new Integer(i));
	    if(fin.get(new Integer(i)) == -1 || mid.get(new Integer(i)) == -1)
		sei.add('F');
	    else if(gou >= 80)
		sei.add('A');
	    else if(gou >= 65)
		sei.add('B');
	    else if(gou >= 50 || rit.get(new Integer(i)) >= 50)
		sei.add('C');
	    else if(gou >= 30)
		sei.add('D');
	    else
		sei.add('F');
	}
	for(i = 0; cnt - 1 != i; i++){
	    System.out.println(sei.get(new Integer(i)));
	}
    }
}