#include <stdio.h>

int main(){
    char sub[51];
    char rank[3];
    float credit, sum_credit=0, sum_rank=0;
    int n=20;

    while(n--){
        scanf("%s %f %s",sub,&credit,rank);
        if(rank[0]!='P'){
            if(rank[0]=='A'){
                if(rank[1]=='+'){ sum_rank += credit*4.5; }
                else{ sum_rank += credit*4.0; }
            }
            else if(rank[0]=='B'){
                if(rank[1]=='+'){ sum_rank += credit*3.5; }
                else{ sum_rank += credit*3.0; }
            }
            else if(rank[0]=='C'){
                if(rank[1]=='+'){ sum_rank += credit*2.5; }
                else{ sum_rank += credit*2.0; }
            }
            else if(rank[0]=='D'){
                if(rank[1]=='+'){ sum_rank += credit*1.5; }
                else{ sum_rank += credit*1.0; }
            }
            sum_credit+=credit;
        }
    }
    printf("%.6f",sum_rank/sum_credit);

    return 0;
}