#include<stdio.h>
#include<string.h>
union Salary {
    int full_time_Salary;
    float hourly_rate;
};
struct Employee {
    char name[50];
    int id;
    int type;
    union Salary pay;
};
int main(){
    int n;
    scanf("%d", &n);
    if(n < 0) {
        printf("-1");
        return 0;
    }
    struct Employee *emp[n];
    double total= 0.0;
    for(int i=0;i<n;i++){
        scanf("%s %d %d", emp[i].name,&emp[i].id,&emp[i].type);
        if(emp[i].type==1){
            scanf("%d ",&emp[i].pay.full_time_Salary);
            total +=emp[i].pay.full_time_Salary;
        }
        else if(emp[i].type==2)
        {
            scanf("%f ",&emp[i].pay.hourly_rate);
            total+=emp[i].pay.hourly_rate*8*30;
        }
    }
    printf("%.2f", total);
    return 0;
}