// editor2
#include<stdio.h>
#include<string.h>
struct Employee
{
    char name[50];
    int id;
    int type;
    union 
    {
        int full_salary;
        float hourly_rate;
    }
    salary;
};
int main()
{
    int n;
    scanf("%d",&n);
    if(n<0)
    {
        printf("-1\n");
        return 0;
    }
    struct Employee employees[10];
    double total_salary=0.0;
    for(int i=0;i<n;i++)
    {
        scanf("%s %d %d",employee[i].name,&employees[i].id, & amployee[i].type);
        if(employee[i].type==1)
        {
            scanf("%d",&employee[i].salary.full_salary);
            total_salary += employees[i].salary.full_salary;
        }
        else if(employee[i].type==2)
        {
            scanf("%f",&employee[i].hourly_rate);
            total_salary += employee[i].salary.hourly_rate;
        }
    }
    printf("%2lf\n",total_salary);
    return 0;
}