#include <stdio.h>
#include <string.h>

union Salary {
    int fullTimeSalary;
    float partTimeRate;
};

struct Employee {
    char name[50];
    int id;
    int type;  // 1 = full-time, 2 = part-time
    union Salary pay;
};

int main() {
    int n;
    scanf("%d", &n);

    if (n < 0) {
        printf("-1\n");
        return 0;
    }

    struct Employee employees[n];
    double totalSalary = 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].pay.fullTimeSalary);
            totalSalary += employees[i].pay.fullTimeSalary;
        } else if (employees[i].type == 2) {
            scanf("%f", &employees[i].pay.partTimeRate);
            totalSalary += employees[i].pay.partTimeRate;
        }
    }

    printf("%.2f\n", total Salary);
    return 0;
}