#include<stdio.h>

typedef union {
    int fullTimeSalary;
    float partTimeHourlyRate;
} salary;

typedef struct {
    char name[100];
    int id;
    int type;
    salary sal;
} Employee;

int main() {
    int n;
    scanf("%d", &n);
    
    if (n < 0) {
        printf("-1");
        return 0;
    }
    
    employee emp;
    float total = 0;
    
    for (int i = 0; i < n; i++) {
        scanf("%s %d %d", emp.name, &emp.id, &emp.type);
        
        if (emp.type == 1) {
            scanf("%d", &emp.sal.fullTimeSalary);
            total += emp.sal.fullTimeHourlyRate;
        }
    }
    
    printf("%.2f", total);
    
    return 0;
}