Problem:
Score : 100 points

Problem Statement

A programming competition site AtCode regularly holds programming contests.

The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.

The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.

The contest after the ARC is called AGC, which is rated for all contestants.

Takahashi's rating on AtCode is R. What is the next contest rated for him?

Constraints

0 ≤ R ≤ 4208

R is an integer.

Input

Input is given from Standard Input in the following format:

R

Output

Print the name of the next contest rated for Takahashi (ABC, ARC or AGC).

Sample Input 1

1199

Sample Output 1

ABC

1199 is less than 1200, so ABC will be rated.

Sample Input 2

1200

Sample Output 2

ARC

1200 is not less than 1200 and ABC will be unrated, but it is less than 2800 and ARC will be rated.

Sample Input 3

4208

Sample Output 3

AGC

Solution in Rust (1.15.1) (judge verdict: Runtime Error)

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn func(i: usize, g: i32, v: &std::vec::Vec<(i32, i32)>) -> Option<i32> {
    if i == 0 {
        // println!("g = {}", g);
        return if g <= 0 { Some(0) } else { None };
    }
    let (p, c) = v[i - 1];
    let mut res = std::vec::Vec::with_capacity((p + 1) as usize);
    for j in 0..(p + 1) {
        // print!("i = {}, j = {}, ", i, j);
        if j == 0 {
            res.push((j, func(i - 1, g, v)));
        } else if 1 <= j && j < p {
            res.push((j, func(i - 1, g - 100 * (i as i32) * j, v)));
        } else {
            res.push((j, func(i - 1, g - 100 * (i as i32) * j - c, v)));
        }
    }
    let r = res.into_iter().flat_map(|(j, r)| r.map(|x| x + j)).min();
    // println!("{:?}", r);
    r
}

fn main() {
    input! {
        d: usize,
        g: i32,
        v: [(i32, i32); d],
    }
    let res = func(d, g, &v).unwrap();
    println!("{}", res);
}