#include<stdio.h>

union Salary{
    int fullTimeSalary;
    float partTimeHourlyRate;
};
struct Employee{
    char name[50];
    int id;
    int type;
    
    union Salary pay;
};
int main(){
    int n,emp;
    scanf("%d",&n);
    
    struct Employee amp[n];
    float totalSalary =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.fullTimeSalary);
            totalSalary += emp[i].pay.fullTimeSalary;
        }else if (emp[i].type ==2){
            scanf("%f",&emp[i].pay.partTimeHoulyRate);
            totalSalary += emp[i].pay.partTimeHourlyRate;
        }
        
    }
    printf("%.2f\n",totalSalary);
    return 0;
}