import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> list = new ArrayList<String>();
		
		//-1 -1 -1?????\?????????????????§??°?????????
		while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		}
		
		//?????±???int???????????????2?¬??????????????§?????????????
		int [][] data = new int[list.size() - 1][3];
		for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		}
		
		//???????????¨?????????
		for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		}
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> list = new ArrayList<String>();
		
		//-1 -1 -1?????\?????????????????§??°?????????
		while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		}
		
		//?????±???int???????????????2?¬??????????????§?????????????
		int [][] data = new int[list.size() - 1][3];
		for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		}
		
		//???????????¨?????????
		for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		}
	}

} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> list = new ArrayList<String>();
		
		//-1 -1 -1?????\?????????????????§??°?????????
		while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		}
		
		//?????±???int???????????????2?¬??????????????§?????????????
		int [][] data = new int[list.size() - 1][3];
		for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		}
		
		//???????????¨?????????
		for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		}
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> list = new ArrayList<String>();
		
		//-1 -1 -1?????\?????????????????§??°?????????
		while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		}
		
		//?????±???int???????????????2?¬??????????????§?????????????
		int [][] data = new int[list.size() - 1][3];
		for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		}
		
		//???????????¨?????????
		for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		} true {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		} list.add(sc.nextLine()) list.add list sc.nextLine() sc.nextLine sc if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			} list.get(list.size() - 1).equals("-1 -1 -1") list.get(list.size() - 1).equals list.get(list.size() - 1) list.get list list.size() - 1 list.size() list.size list 1 "-1 -1 -1" {
				break;
			} break; int [][] data = new int[list.size() - 1][3]; data new int[list.size() - 1][3] list.size() - 1 list.size() list.size list 1 3 for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		} int i = 0; int i = 0; i 0 i < list.size() - 1 i list.size() - 1 list.size() list.size list 1 i++ i++ i {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		} {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		} String s = list.get(i); s list.get(i) list.get list i String [] ary = s.split(" "); ary s.split(" ") s.split s " " for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			} int j = 0; int j = 0; j 0 j < ary.length j ary.length ary ary.length j++ j++ j {
				data[i][j] = Integer.parseInt(ary[j]);
			} {
				data[i][j] = Integer.parseInt(ary[j]);
			} data[i][j] = Integer.parseInt(ary[j]) data[i][j] data[i] data i j Integer.parseInt(ary[j]) Integer.parseInt Integer ary[j] ary j for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		} int i = 0; int i = 0; i 0 i < data.length i data.length data data.length i++ i++ i {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		} {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		} int sum = 0; sum 0 for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			} int j = 0; int j = 0; j 0 j < data[i].length - 1 j data[i].length - 1 data[i].length data[i] data i data[i].length 1 j++ j++ j {
				sum += data[i][j];
			} {
				sum += data[i][j];
			} sum += data[i][j] sum data[i][j] data[i] data i j if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			} data[i][0] == -1 || data[i][1] == -1 data[i][0] == -1 data[i][0] data[i] data i 0 -1 1 data[i][1] == -1 data[i][1] data[i] data i 1 -1 1 {
				System.out.println("F");
			} System.out.println("F") System.out.println System.out System System.out "F" if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			} sum >= 80 sum 80 {
				System.out.println("A");
			} System.out.println("A") System.out.println System.out System System.out "A" if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			} sum >= 65 sum 65 {
				System.out.println("B");
			} System.out.println("B") System.out.println System.out System System.out "B" if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			} sum >= 50 sum 50 {
				System.out.println("C");
			} System.out.println("C") System.out.println System.out System System.out "C" if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			} sum >= 30 sum 30 {
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			} if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				} data[i][2] >= 50 data[i][2] data[i] data i 2 50 {
					System.out.println("C");
				} System.out.println("C") System.out.println System.out System System.out "C" {
					System.out.println("D");
				} System.out.println("D") System.out.println System.out System System.out "D" {
				System.out.println("F");
			} System.out.println("F") System.out.println System.out System System.out "F" String[] args args public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> list = new ArrayList<String>();
		
		//-1 -1 -1?????\?????????????????§??°?????????
		while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		}
		
		//?????±???int???????????????2?¬??????????????§?????????????
		int [][] data = new int[list.size() - 1][3];
		for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		}
		
		//???????????¨?????????
		for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> list = new ArrayList<String>();
		
		//-1 -1 -1?????\?????????????????§??°?????????
		while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		}
		
		//?????±???int???????????????2?¬??????????????§?????????????
		int [][] data = new int[list.size() - 1][3];
		for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		}
		
		//???????????¨?????????
		for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		}
	}

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		ArrayList<String> list = new ArrayList<String>();
		
		//-1 -1 -1?????\?????????????????§??°?????????
		while(true) {
			
			//list???????´???????
			list.add(sc.nextLine());
			if(list.get(list.size() - 1).equals("-1 -1 -1")) {
				break;
			}
		}
		
		//?????±???int???????????????2?¬??????????????§?????????????
		int [][] data = new int[list.size() - 1][3];
		for(int i = 0; i < list.size() - 1; i++) {
			String s = list.get(i);
			String [] ary = s.split(" ");
			for(int j = 0; j < ary.length; j++) {
				data[i][j] = Integer.parseInt(ary[j]);
			}
		}
		
		//???????????¨?????????
		for(int i = 0; i < data.length; i++) {
			int sum = 0;
			for(int j = 0; j < data[i].length - 1; j++) {
				sum += data[i][j];
			}
			if(data[i][0] == -1 || data[i][1] == -1) {
				System.out.println("F");
			}else if(sum >= 80) {
				System.out.println("A");
			}else if(sum >= 65) {
				System.out.println("B");
			}else if(sum >= 50) {
				System.out.println("C");
			}else if(sum >= 30){
				if(data[i][2] >= 50){
					System.out.println("C");
				}else {
					System.out.println("D");
				}
			}else {
				System.out.println("F");
			}
		}
	}

}