#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", tota)
}