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