#include<stdio.h>
struct Employee{
    char name[50];
    int id;
    int type;
    union{
        int fullsalary;
        float hourlyRate;
    }
}
int main(){
    int n,i;
    scanf("%d",&n);
    struct Employee emp[n];
    double total=0.0;
    for(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.fullsalary);
            total+=emp[i].pay.hourlyRate;
        }
    }
    printf("%.2f",total);
    return 0;
}