const n = require("fs").readFileSync(0,"utf8").toString().split("\n");
let grade = {
    "A+": 4.5, "A0": 4.0,
    "B+": 3.5, "B0": 3.0,
    "C+": 2.5, "C0": 2.0,
    "D+": 1.5, "D0": 1.0,
    "F": 0.0
}
let sum_credit=0, sum_rate=0;

for(let i=0; i<20; i++){
    let [sub, credit, rate] = n[i].split(" ");
    credit = parseFloat(credit);
    if(rate==='P') continue;
    sum_credit += credit;
    sum_rate += credit * grade[rate];
}

console.log((sum_rate/sum_credit).toFixed(6));
