import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double hak = 0.0;
double totalHak = 0.0;
double total = 0.0;
String grade;
for(int i = 0; i < 20; i++) {
String score = br.readLine();
StringTokenizer st = new StringTokenizer(score);
st.nextToken();
hak = Double.parseDouble(st.nextToken());
grade = st.nextToken();
switch (grade)
{
case "A+" : total += hak * 4.5; totalHak += hak; break;
case "A0" : total += hak * 4.0; totalHak += hak; break;
case "B+" : total += hak * 3.5; totalHak += hak; break;
case "B0" : total += hak * 3.0; totalHak += hak; break;
case "C+" : total += hak * 2.5; totalHak += hak; break;
case "C0" : total += hak * 2.0; totalHak += hak; break;
case "D+" : total += hak * 1.5; totalHak += hak; break;
case "D0" : total += hak; totalHak += hak; break;
case "F" : totalHak += hak; break;
default: break;
}
}
System.out.printf("%.6f", total / totalHak);
}
}
totalHak 이랑 F일때 계산을 잘못해서 해매고 있다가 약간의 도움을 받아서 해결했다.