#include<stdio.h>
#include<string.h>

#define FULL_TIME_MONTHLY_HOURS 80
#define MAX_EMPLOYEES 100

union Salary
{
    int fullTime;
    float hourlyRate;
};

struct Employee
{
    char name[50];
    int id;
    int type;
    union Salary sal;
};

    double calculateTotalSalaries(struct Employee employees[], int n)
    {
        double total = 0.0;
        for (int i=0; i<n; i++)
        {
            if(employees[i].type == 1)
            {
                total += employees[i].sal.fullTime;
            }
            else if (employees[i].type == 2)
            {
                total += employees[i].sal.hourlyRate * FULL_TIME_MONTHLY_HOURS;
            }
        }
        return total;
    }
    
    int main()
    {
        int n;
        if (scanf("%d", &n) != 1) return EXIT_FATLURE;
        
        if(n <= 0)
        {
            printf("-1\n");
            return EXIT_FATLURE;
        }
        
        struct Employee employees[MAX_EMPLOYEES];
        
        for (int i = 0; i < n; i++)
        {
            if(scanf("%s %d %d", employees[i].name, &employees[i].id, &employees[i].type) != 3)
            {
                return EXIT_FATLURE;
            }
            if (employees[i].type == 1)
            {
                scanf("%d", &employees[i].sal.fullTime);
            }
            else if (employees[i].type == 2)
            {
                scanf("%f", &employees[i].sal.hourlyRate);
            }
        }
        
        double total = calculateTotalSalaries(employees, n);
        printf("%.2f\n", total);
        return EXIT_SUCCESS;
    }