/*#include <stdio.h>
#include <string.h>
#define MAX_EMPLOYEES 100
union Salary{
    float fulltimeSalary;
    float partTimeHourlyRate;
};
struct Employee{
    char name[50];
    int id;
    int type;
    union Salary salary;
};
void calculateSalaries(struct Employee employees[],int n){
    float totalSalaries=0.0;
    for(int i=0;i<n;i++){
        if(employees[i].type==1){
            totalSalaries += employees[i].salary.fulltimeSalary;
        }
        else if(employees[i].type==2){
            totalSalaries += employees[i].salary.partTimeHourlyRate;
        }
    }
    printf("%.2f\n",totalSalaries);
}
int main(){
    struct Employee employees[MAX_EMPLOYEES];
    int n;
    scanf("%d", &n);
    if(n<0){
        printf("-1");
        return 0;
    }
    for(int i=0;i<n;i++){
        scanf("%s %d %d", employees[i].name,&employees[i].id,&employees[i].type);
        if(employees[i].type==1){
            scanf("%f", &employees[i].salary.fulltimeSalary);
        }
        else if(employees[i].type==2){
            scanf("%f", &employees[i].salary.partTimeHourlyRate);
        }
    }
    calculateSalaries(employees,n);
}*/
#include <stdio.h>
int main(){
    int n;
    scanf("%d", &n);
    if(n < 0){
        printf("-1");
        return 0;
    }
    float totalsalary = 0.0;
    for(int i = 0; i < n; i++){
        char name[200];
        int id,type;
        scanf("%[^\n]",name)
        scanf("%d %d",&id, &type);
        if(type == 1){
            int salary;
            scanf(" %d", &salary);
            totalsalary += salary;
        }
        else if(type == 2){
            float hourlyrate;
            float hours = 1;
            int items = scanf("%f %f",&hourlyrate,&hours);
            if(items == 1){
                totalsalary += hourlyrate*hours;
            }
        }
    }
    printf("%.2f", totalsalary);
    return 0;
}