#include<stdio.h>
#include<string.h>
union PayInfo {
    float fullTimeSalary;
    struct {
        float hour1yRate;
        int hoursWorked;
    } partTime;
};
struct Employee {
    char name[101];
    int id;
    int type;
    union PayInfo pay;
};
int main() {
    int N;
    scanf("%d", &N);
    if (n < 0) {
        printf("-1");
        return 0;
    }
    struct Employee e;
    float total = 0.0f;
    for (int i = 0; i < N; i++) {
        scanf("%s", e.name);
        scanf("%d %d", &e.id, &e.type);
        if(e.type == 1) {
            scanf("%f", &e.pay.fullTimeSalary);
            total += e.pay.fullTimeSalary;
        } else if(e.type == 2) {
            scanf("%f %d", &e.pay.partTime.hourlyRate,
            e.pay.partTime.hoursWorked);
            total +=
            e.pay.partTime.hourlyRate * e.pay.partTime.hoursWorked;
        }
    }
    printf("%.2f", total);
    return 0;
}