#include <stdio.h>
#include <stdlib.h>
#include <string.h>

union SalaryDetails {
    int full_time_salary;
    float part_time_hourly_rate;
};

struct Employee {
    char name[50];
    int id;
    int type;
    union SalaryDetails details;
};
int main() {
    int n;
    if (scanf("%d", &n) != 1) {
        return 1;
    }
    
    if(n < 0) {
        printf("-1\n");
        return 0;
    }
    struct Employee employees;
    float total_salaries =0.0;
    
    for(int i = 0; i < n; i++) {
        if (scanf("%s %d %d", employees[i].name, &employees[i].id, &employees[i].type != 3) {
            return 1;
        }
        
        if (employees[i].type == 1) {
            scanf("%d", &employees[i].details.full_time_salary);
            total_salaries += employees[i].details.full_time_salary;
        } else if (employees[i].type == 2) {
            scanf("%f", &employees[i].details.part_time_hourly_rate);
            total_salaries += employees[i].details.part_time_hourly_rate;
        }
        }
        printf("%.2f\n", total_salaries);
        
        return 0;
}