#include<stdio.h>
#include<string.h>
#include<stdlib.h>
union Salary {
    int full_time_Salary;
    float hourly_rate;
};
struct Employee {
    char name[50];
    int id;
    int type;
    union Salary pay;
};
int main(){
    int n;
    scanf("%d", &n);
    if(n < 0) {
        printf("-1");
        return 0;
    }
    struct Employee *emp[n];
    double total= 0.0;
    for(int i=0;i<n;i++)
    emp[i]=(struct Employee*)malloc(sizeof(struct Employee));{
    if(emp[i]==NULL)
        fprintf(stderr,"Memory allocation failed.\n");
        for(int j=0;j<i;j++){
            free(emp[j]);
        }
        return 1;
    }
    {
        scanf("%s %d %d", emp[i]->name,&emp[i]->id,&emp[i]->type);
        if(emp[i]->type==1){
            scanf("%d ",&emp[i]->pay.full_time_Salary);
            total +=emp[i]->pay.full_time_Salary;
        }
        else if(emp[i]->type==2)
        {
            scanf("%f ",&emp[i]->pay.hourly_rate);
            total+=emp[i]->pay.hourly_rate*8*30;
        }
    }
    printf("%.2f",total);
    for(int i=0;i<n;i++){
        free(emp[i]);
    }
    return 0;
}