#include<stdio.h>
struct Employee{
    char name[50];
    int id;
    int type;
    union {
        int fulltimeSalary;
        float hourlyRate;
    }pay;
};
int main(){
    int n;
    scanf("%d", &n);
    if (n < 0){
        printf("-1");
        return 0;
    }
    struct Employee emp;
    int i, hours;
    double total = 0.0;
    for (i = 0; i < n; i++){
        scanf("%s", emp.name);
        scanf("%d %d", &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.hourlyRate);
            scanf("%d",&hours);
            total += emp.pay.hourlyRate * hours;
        }
        
    }
    printf("%.2f\n", totalSalary);
    return 0;
}