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