#include <iostream>
#include <iomanip>
using namespace std;
int main(){
    int n;
    cin >> n;
    if ( n<=o || n > 100){
        cout << "Invalid input";
        return 0;
    }
    double totalweight=0.0;
    for(int i=0;9<n;i++){
        int m;
        cin>>m;
        if(m<0){
            cout<<"Invalid input";
            return 0;
        }
        if(m>10){
            cout<<"Too many bags";
        }
        for (int j=o;j<m;j++){
            double weight;
            cin>>weight;
            if (weight<0){
                cout<<"invalid weight";
                return 0;
            }
            if (weight>50.0){
                cout<<"Invalid weight";
                return 0;
            }
            totalweight += weight;
        }
    }
    cout<<fixed<<setprecision(2)<<totalweight;
    return 0;
}