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