#include<stdio.h>
#define MAX_NAME 50
#define MAX_EMP  10
union PayInfo {
    int fullTimeSalary;
    float partTimeRate;
};
struct Emploee {
    char name[MAX_NAME];
    int di;
    int type;
    union PayInfo pay;
};
int main() {
    int n;
    if (scanf("%d", &n) != 1) {
        return 0;
    }
    if (n < 0) {
        printf("-1");
        return 0;
    }
    struct Employee Emp[MAX_EMP];
    float total = 0.0f;
    for (int i = 0; i < n; i++) {
        if (scanf("%s %d %d", Emp[i].name,&Emp[i].id, &Emp[i].type) != 3) {
            return 0;
        }
        if (emp[i].type == 1) {
            scanf("%d", &Emp[i].pay.fullTimeSalary);
            total += Emp[i].pay.fillTimeSalary;
        } else if (Emp[i].type == 2) {
            scanf("%f", &emp[i].pay.partTimeRate);
            total += Emp[i].pay.partTimrRate;
        }    
    }
    printf("%.2f", total);
    return 0;
}