// editor3
#include <iostream>
#include<iomanip>
using namespace std;
int main()
{
    int n;
    if(!(cin>>n))return 0;
    double totalWeight=0.0;
    for(int i=0;i<n;i++){
        int m;
        cin>>m;
        if(m>10){
            cout<<"Too many bags"<<endl;
            return 0;
            
        }
        for(int j=0;j<m;j++){
            double weight;
            cin>>weight;
            if(weight<0){
                cout<<"Invalid Weight"<<endl;
                return 0;
            }
            totalweight+=weight;
        }
    }cout<<fixed<<setprecision(2)<<totalWeight<<endl;
    return 0;
}