#include<stdio.h>
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++) {
        scanf("%s %d %d", employees[i].name, &employees[i].id, &employees[i].type);
        
        
        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;
}