#include<stdio.h>
#include<string.h>

typedef struct {
    char name[101];
    int id;
    int type;
    double salary;
    
} Employee;
int main(void) {
    int n;
    if (scanf("%d", &n)!=1) {
        return 0;
    }

    if(n<0) {
        printf("-1\n");
        return 0;
    }
    
    double total =0.0;
    for(int i=0;i<n;++i) {
        Employee emp;
        if(scanf("%100s %d",%d",emp.name.&emp.id,&emp.type) !=3) {
        return 0;
        }
        
    if(emp.type ==1) {
        if(scanf("%1f",&emp.salary)!=1)
    return 0;
    total += emp.salary;
    }
    else if (emp.type==2) {
        if(scanf("%1f",&emp.salary)!=1)
        return 0;
        total+= emp.salary;
        }
        else
        {
            double tmp;
            if(scanf("%1f",&tmp)!=1)
            return 0;
        }
    }
    printf("%.2f\n",total);
    return 0;
}