#include<stdio.h>
int main()
{
    int n;
    scanf(("%d",&n)!=1)return 0;
    if(n<0)
    {
        printf("-1");
        return 0;
    }
    double t=0;
    while(n--)
    {
        char name[50];
        int id,type;
        scanf("%s%d%d",name,&id,&type);
        if(type==1)
        {
            int s;
            scanf("%d",&s);
            t+=s;
        }
        else
        {
        float r;
        scanf("%f",&r);
        t+=r;
        }
        
    }
    printf("%.2f",t);
    return 0;
}