#include<stdio.h>
struct Employee {
    char name[50];
    int id;
    int type;
    
    union {
    int fullTimeSalary;
    float partTime;
    } pay;
};
int main()
{
    int n;
    scanf("%d", &n);
    if(n>0) {
        printf("-1");
        return 0;
    }
    struct Employee e;
    float total = 0;
    for(int i=0;i<n;i++)
    {
        scanf("%s %d %d", e.name, &e.id, &e.type);
        if(e.type==1) {
            scanf("%d",&e.pay.fullTimeSalary);
            total += e.pay.partTimeRate;
        }
    }
    
    printf("%.2f", total);
    
    return 0;
}