#include<stdio.h>
union Salary {
    int fullTimeSalary;
    float partTimeRate;
};
struct Employee {
    char name[1000];
    int id;
    int type;
    union Salary payment ;
};
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("-1");
        return 0;
    }
    struct Employee *employees=malloc(n*sizeof(struct Employee));
    double totalSalary= 0.0;
    for(int i=0;i<n;i++){
        scanf("%s %d %d",employees[i].name, &employees[i].id, &employees[i],type);
        if(employees[i].type==FULL_TIME){
            scanf("%d",&employees[i].payment.fulltimesalary);
            tatalSalaries+=employees[i].payment.fullTimesallery;
        }
        else if(employees[i].type==PART_TIME)
        {
            scanf("%f",&employees[i].payment.partTimeSalary);
            totalSalaries+=employees[i].payment.partTimeRate*40;
        }
    }
    printf("%.2f", totalSalaries);
    return 0;
}