// editor2
#include<stdio.h>
union salary
{
    int fulltime;
    float parttime;
};
struct employee
{
    char name[50];
    int id;
    int type;
    union salary salary;
};
int main()
{
    int n;
    float total=0;
    scanf("%d",&n);
    struct employee emp;
    for(int i=0;i<n;i++)
    {
        scanf("%s %d %d",emp.name,&emp.id,&emp.type);
        if(emp.type==1)
        {
            scanf("%d",&emp.salary.fulltime);
            total+=emp.salary.fulltime;
        }
        else 
        {
            scanf("%f",&emp.salary.parttime);
            totalsalary+=emp.salary.parttime;
        }
    }
    printf("%.2f\n", total);
    return 0;
}