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

public class Main {

    private static final int ABSENT = -1;

    protected static String process(String data) {
        StringBuilder sb = new StringBuilder();
        final String[] lines = splitForLines(data);

        for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        }

        return sb.toString();
    }

    static Grade calcGrade(int midScore, int finalScore, int retestScore) {
        if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        }

        final int baseScore = midScore + finalScore;

        if (baseScore >= 80) {
            return Grade.A;
        }

        if (baseScore >= 65) {
            return Grade.B;
        }

        if (baseScore >= 50) {
            return Grade.C;
        }

        if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        }

        return Grade.F;
    }

    enum Grade {
        A, B, C, D, F
    }

    private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }

    private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    public static void main(String[] args) {
        System.out.print(process(readAll(System.in)));
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    private static final int ABSENT = -1;

    protected static String process(String data) {
        StringBuilder sb = new StringBuilder();
        final String[] lines = splitForLines(data);

        for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        }

        return sb.toString();
    }

    static Grade calcGrade(int midScore, int finalScore, int retestScore) {
        if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        }

        final int baseScore = midScore + finalScore;

        if (baseScore >= 80) {
            return Grade.A;
        }

        if (baseScore >= 65) {
            return Grade.B;
        }

        if (baseScore >= 50) {
            return Grade.C;
        }

        if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        }

        return Grade.F;
    }

    enum Grade {
        A, B, C, D, F
    }

    private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }

    private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    public static void main(String[] args) {
        System.out.print(process(readAll(System.in)));
    }
} Main private static final int ABSENT = -1; ABSENT -1 1 protected static String process(String data) {
        StringBuilder sb = new StringBuilder();
        final String[] lines = splitForLines(data);

        for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        }

        return sb.toString();
    } process {
        StringBuilder sb = new StringBuilder();
        final String[] lines = splitForLines(data);

        for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        }

        return sb.toString();
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() final String[] lines = splitForLines(data); lines splitForLines(data) splitForLines data for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        } String line lines {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        } {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        } final int[] split = split(line); split split(line) split line final int midScore = split[0]; midScore split[0] split 0 final int finalScore = split[1]; finalScore split[1] split 1 final int retestScore = split[2]; retestScore split[2] split 2 if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            } midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT midScore == ABSENT midScore ABSENT finalScore == ABSENT finalScore ABSENT retestScore == ABSENT retestScore ABSENT {
                break;
            } break; sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n') sb.append(calcGrade(midScore, finalScore, retestScore)).append sb.append(calcGrade(midScore, finalScore, retestScore)) sb.append sb calcGrade(midScore, finalScore, retestScore) calcGrade midScore finalScore retestScore '\n' return sb.toString(); sb.toString() sb.toString sb String data data static Grade calcGrade(int midScore, int finalScore, int retestScore) {
        if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        }

        final int baseScore = midScore + finalScore;

        if (baseScore >= 80) {
            return Grade.A;
        }

        if (baseScore >= 65) {
            return Grade.B;
        }

        if (baseScore >= 50) {
            return Grade.C;
        }

        if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        }

        return Grade.F;
    } calcGrade {
        if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        }

        final int baseScore = midScore + finalScore;

        if (baseScore >= 80) {
            return Grade.A;
        }

        if (baseScore >= 65) {
            return Grade.B;
        }

        if (baseScore >= 50) {
            return Grade.C;
        }

        if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        }

        return Grade.F;
    } if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        } midScore == ABSENT || finalScore == ABSENT midScore == ABSENT midScore ABSENT finalScore == ABSENT finalScore ABSENT {
            return Grade.F;
        } return Grade.F; Grade.F Grade Grade.F final int baseScore = midScore + finalScore; baseScore midScore + finalScore midScore finalScore if (baseScore >= 80) {
            return Grade.A;
        } baseScore >= 80 baseScore 80 {
            return Grade.A;
        } return Grade.A; Grade.A Grade Grade.A if (baseScore >= 65) {
            return Grade.B;
        } baseScore >= 65 baseScore 65 {
            return Grade.B;
        } return Grade.B; Grade.B Grade Grade.B if (baseScore >= 50) {
            return Grade.C;
        } baseScore >= 50 baseScore 50 {
            return Grade.C;
        } return Grade.C; Grade.C Grade Grade.C if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        } baseScore >= 30 baseScore 30 {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        } if (retestScore >= 50) {
                return Grade.C;
            } retestScore >= 50 retestScore 50 {
                return Grade.C;
            } return Grade.C; Grade.C Grade Grade.C return Grade.D; Grade.D Grade Grade.D return Grade.F; Grade.F Grade Grade.F int midScore midScore int finalScore finalScore int retestScore retestScore private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    } readAll {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    } InputStreamReader r = null; r null BufferedReader br = null; br null try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } IOException e {
            throw new RuntimeException(e);
        } throw new RuntimeException(e); new RuntimeException(e) {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        } if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            } br != null br null {
                try {
                    br.close();
                } catch (IOException e) {
                }
            } try {
                    br.close();
                } catch (IOException e) {
                } catch (IOException e) {
                } IOException e {
                } {
                    br.close();
                } br.close() br.close br if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            } r != null r null {
                try {
                    r.close();
                } catch (IOException e) {
                }
            } try {
                    r.close();
                } catch (IOException e) {
                } catch (IOException e) {
                } IOException e {
                } {
                    r.close();
                } r.close() r.close r {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } r = new InputStreamReader(is) r new InputStreamReader(is) br = new BufferedReader(r) br new BufferedReader(r) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String s; s while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            } (s = br.readLine()) != null (s = br.readLine()) s br.readLine() br.readLine br null {
                sb.append(s).append('\n');
            } sb.append(s).append('\n') sb.append(s).append sb.append(s) sb.append sb s '\n' return sb.toString(); sb.toString() sb.toString sb InputStream is is private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    } splitForLines {
        return lines.split("\\n");
    } return lines.split("\\n"); lines.split("\\n") lines.split lines "\\n" String lines lines private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    } split {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    } final String[] s0 = s.split(" "); s0 s.split(" ") s.split s " " int[] ia = new int[s0.length]; ia new int[s0.length] s0.length s0 s0.length for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        } int i = 0; int i = 0; i 0 i < s0.length i s0.length s0 s0.length i++ i++ i {
            ia[i] = Integer.parseInt(s0[i]);
        } {
            ia[i] = Integer.parseInt(s0[i]);
        } ia[i] = Integer.parseInt(s0[i]) ia[i] ia i Integer.parseInt(s0[i]) Integer.parseInt Integer s0[i] s0 i return ia; ia String s s public static void main(String[] args) {
        System.out.print(process(readAll(System.in)));
    } main {
        System.out.print(process(readAll(System.in)));
    } System.out.print(process(readAll(System.in))) System.out.print System.out System System.out process(readAll(System.in)) process readAll(System.in) readAll System.in System System.in String[] args args enum Grade {
        A, B, C, D, F
    } Grade A A B B C C D D F F import java.io.BufferedReader;
imp import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import ja public class Main {

    private static final int ABSENT = -1;

    protected static String process(String data) {
        StringBuilder sb = new StringBuilder();
        final String[] lines = splitForLines(data);

        for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        }

        return sb.toString();
    }

    static Grade calcGrade(int midScore, int finalScore, int retestScore) {
        if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        }

        final int baseScore = midScore + finalScore;

        if (baseScore >= 80) {
            return Grade.A;
        }

        if (baseScore >= 65) {
            return Grade.B;
        }

        if (baseScore >= 50) {
            return Grade.C;
        }

        if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        }

        return Grade.F;
    }

    enum Grade {
        A, B, C, D, F
    }

    private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }

    private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    public static void main(String[] args) {
        System.out.print(process(readAll(System.in)));
    }
} public class Main {

    private static final int ABSENT = -1;

    protected static String process(String data) {
        StringBuilder sb = new StringBuilder();
        final String[] lines = splitForLines(data);

        for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        }

        return sb.toString();
    }

    static Grade calcGrade(int midScore, int finalScore, int retestScore) {
        if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        }

        final int baseScore = midScore + finalScore;

        if (baseScore >= 80) {
            return Grade.A;
        }

        if (baseScore >= 65) {
            return Grade.B;
        }

        if (baseScore >= 50) {
            return Grade.C;
        }

        if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        }

        return Grade.F;
    }

    enum Grade {
        A, B, C, D, F
    }

    private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }

    private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    public static void main(String[] args) {
        System.out.print(process(readAll(System.in)));
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {

    private static final int ABSENT = -1;

    protected static String process(String data) {
        StringBuilder sb = new StringBuilder();
        final String[] lines = splitForLines(data);

        for (String line : lines) {
            final int[] split = split(line);

            final int midScore = split[0];
            final int finalScore = split[1];
            final int retestScore = split[2];

            if (midScore == ABSENT && finalScore == ABSENT && retestScore == ABSENT) {
                break;
            }

            sb.append(calcGrade(midScore, finalScore, retestScore)).append('\n');
        }

        return sb.toString();
    }

    static Grade calcGrade(int midScore, int finalScore, int retestScore) {
        if (midScore == ABSENT || finalScore == ABSENT) {
            return Grade.F;
        }

        final int baseScore = midScore + finalScore;

        if (baseScore >= 80) {
            return Grade.A;
        }

        if (baseScore >= 65) {
            return Grade.B;
        }

        if (baseScore >= 50) {
            return Grade.C;
        }

        if (baseScore >= 30) {
            if (retestScore >= 50) {
                return Grade.C;
            }
            return Grade.D;
        }

        return Grade.F;
    }

    enum Grade {
        A, B, C, D, F
    }

    private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }

    private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    public static void main(String[] args) {
        System.out.print(process(readAll(System.in)));
    }
}