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