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