#include<iostream>
#include<iomanip>
using namespace std;

class Baggage {
    private:
    static double totalWeight;
    static const int MAX_BAGS;
    
    public:
    static void calculate() {
        int n;
        cin >> n;
        
        totalWeight = 0;
        
        for (int i =0; i < n; i++) {
            int m;
            cin >> m;
            
            if (m > MAX_BAGS) {
                cout << "Too many bags";
                return;
            }
            
            for (int j = 0; j < m; j++) {
                double w;
                cin >> w;
                
                if (w < 0) {
                    cout << "Invalid Weight";
                    return;
                }
                
                totalWeight += w;
            }
        }
        
        cout << fixed << setprecision(2) << totalWeight;
    }
};

double Baggage :: totalWeight :: totalWeight = 0;

int main() {
    Baggage :: calculate();
    return 0;
}