#include<bits/stdc++.h>
using namespace std;
const int k = 1e7;
const int w = 1e6;
int main()
{
int p1, p0, f, l;
cin >> p1 >> p0 >> f >> l;
int n = p1 + p0 + f + l;
int s = (k / n + 1) * p1 + (k / n) * p0 + (k / n / 2) + f;
if(s < 8.6 * w) cout << "D" << endl;
else if(s < 8.9 * w) cout << "C" << endl;
else if(s < 9.2 * w) cout << "B" << endl;
else if(s < 9.5 * w) cout << "A" << endl;
else if(s < 9.8 * w) cout << "AA" << endl;
else if(s < 9.9 * w) cout << "EX" << endl;
else cout << "EX+" << endl;
return 0;
}