
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String[] columns;
        int ZENKI = 0;
        int KOUKI = 1;
        int SAITEST = 2;

        int score1 = 0;
        int score2 = 0;
        int score3 = 0;

        while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        }
        System.out.print(builder);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String[] columns;
        int ZENKI = 0;
        int KOUKI = 1;
        int SAITEST = 2;

        int score1 = 0;
        int score2 = 0;
        int score3 = 0;

        while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        }
        System.out.print(builder);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String[] columns;
        int ZENKI = 0;
        int KOUKI = 1;
        int SAITEST = 2;

        int score1 = 0;
        int score2 = 0;
        int score3 = 0;

        while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        }
        System.out.print(builder);
    } main {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String[] columns;
        int ZENKI = 0;
        int KOUKI = 1;
        int SAITEST = 2;

        int score1 = 0;
        int score2 = 0;
        int score3 = 0;

        while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        }
        System.out.print(builder);
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) StringBuilder builder = new StringBuilder(); builder new StringBuilder() String[] columns; columns int ZENKI = 0; ZENKI 0 int KOUKI = 1; KOUKI 1 int SAITEST = 2; SAITEST 2 int score1 = 0; score1 0 int score2 = 0; score2 0 int score3 = 0; score3 0 while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        } true {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        } String line = reader.readLine(); line reader.readLine() reader.readLine reader columns = line.split(" ") columns line.split(" ") line.split line " " if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            } Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1 Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1 Integer.parseInt(columns[ZENKI]) == -1 Integer.parseInt(columns[ZENKI]) Integer.parseInt Integer columns[ZENKI] columns ZENKI -1 1 Integer.parseInt(columns[KOUKI]) == -1 Integer.parseInt(columns[KOUKI]) Integer.parseInt Integer columns[KOUKI] columns KOUKI -1 1 Integer.parseInt(columns[SAITEST]) == -1 Integer.parseInt(columns[SAITEST]) Integer.parseInt Integer columns[SAITEST] columns SAITEST -1 1 {
                break;
            } break; score1 = Integer.parseInt(columns[ZENKI]) score1 Integer.parseInt(columns[ZENKI]) Integer.parseInt Integer columns[ZENKI] columns ZENKI score2 = Integer.parseInt(columns[KOUKI]) score2 Integer.parseInt(columns[KOUKI]) Integer.parseInt Integer columns[KOUKI] columns KOUKI score3 = Integer.parseInt(columns[SAITEST]) score3 Integer.parseInt(columns[SAITEST]) Integer.parseInt Integer columns[SAITEST] columns SAITEST if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            } score1 == -1 || score2 == -1 || score1 + score2 < 30 score1 == -1 || score2 == -1 || score1 + score2 < 30 score1 == -1 score1 -1 1 score2 == -1 score2 -1 1 score1 + score2 < 30 score1 + score2 score1 score2 30 {
                builder.append("F");
            } builder.append("F") builder.append builder "F" if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            } (score1 + score2) >= 80 (score1 + score2) score1 score2 80 {
                builder.append("A");
            } builder.append("A") builder.append builder "A" if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            } score1 + score2 < 80 && score1 + score2 >= 65 score1 + score2 < 80 score1 + score2 score1 score2 80 score1 + score2 >= 65 score1 + score2 score1 score2 65 {
                builder.append("B");
            } builder.append("B") builder.append builder "B" if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            } score1 + score2 < 65 && score1 + score2 >= 50 score1 + score2 < 65 score1 + score2 score1 score2 65 score1 + score2 >= 50 score1 + score2 score1 score2 50 {
                builder.append("C");
            } builder.append("C") builder.append builder "C" if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            } score1 + score2 < 50 && score1 + score2 >= 30 score1 + score2 < 50 score1 + score2 score1 score2 50 score1 + score2 >= 30 score1 + score2 score1 score2 30 {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            } if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                } score3 >= 50 score3 50 {
                    builder.append("C");
                } builder.append("C") builder.append builder "C" {
                    builder.append("D");
                } builder.append("D") builder.append builder "D" builder.append("\n") builder.append builder "\n" System.out.print(builder) System.out.print System.out System System.out builder String[] args args public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String[] columns;
        int ZENKI = 0;
        int KOUKI = 1;
        int SAITEST = 2;

        int score1 = 0;
        int score2 = 0;
        int score3 = 0;

        while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        }
        System.out.print(builder);
    }
} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String[] columns;
        int ZENKI = 0;
        int KOUKI = 1;
        int SAITEST = 2;

        int score1 = 0;
        int score2 = 0;
        int score3 = 0;

        while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        }
        System.out.print(builder);
    }
} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String[] columns;
        int ZENKI = 0;
        int KOUKI = 1;
        int SAITEST = 2;

        int score1 = 0;
        int score2 = 0;
        int score3 = 0;

        while (true) {

            String line = reader.readLine();
            columns = line.split(" ");
            if (Integer.parseInt(columns[ZENKI]) == -1
                    && Integer.parseInt(columns[KOUKI]) == -1
                    && Integer.parseInt(columns[SAITEST]) == -1) {
                break;
            }
            score1 = Integer.parseInt(columns[ZENKI]);
            score2 = Integer.parseInt(columns[KOUKI]);
            score3 = Integer.parseInt(columns[SAITEST]);

            if (score1 == -1 || score2 == -1 || score1 + score2 < 30) {
                builder.append("F");
            } else if ((score1 + score2) >= 80) {
                builder.append("A");
            } else if (score1 + score2 < 80 && score1 + score2 >= 65) {
                builder.append("B");
            } else if (score1 + score2 < 65 && score1 + score2 >= 50) {
                builder.append("C");
            } else if (score1 + score2 < 50 && score1 + score2 >= 30) {
                if (score3 >= 50) {
                    builder.append("C");
                }
                else {
                    builder.append("D");
                }
            }
            builder.append("\n");
        }
        System.out.print(builder);
    }
}