// editor2
#include<stdio.h>
union Emp{
    int full;
    float h;
};
struct e{
    char n[105];
    int id,t;
    union Emp pay;
};
int main()
{
    int n;
    if(scanf("%d",&n)!=1)
    return 0;
    if(n<0)
    {
        printf("-1");
        return 0;
    }
    struct e E;
    double to=0.0;
    for(int i=0;i<n;i++)
    {
        if(scanf("%s %d %d",E.n,&E.id,&E.t)!=3)
        return 0;
    if(E.t==1)
    {
        scanf("%d",&E.pay.full);
        to+=E.pay.full;
    }
    else if(e.type==2)
    {
        scanf("%f",&E.pay.h);
        to+=E.pay.h;
    }
    }
    return 0
}