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