// Carden Lantern [AOJ 0072]
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair <int, int> PII;
typedef pair <int, PII> PIP;
typedef vector <PIP>    Edges;

const int size = 101;
int P[size];

void init( int n ) {
    for ( int i = 0; i < n; i++ ) {
        P[i] = -1;
    }
}

int find( int a ) {
    if ( P[a] == -1 ) {
        return a;
    }
    return P[a] = find( P[a] );
}

void merge( int a, int b ) {
    int fa = find( a ), fb = find( b );

    if ( fa != fb ) {
        if ( P[a] == -1 ) {
            P[a] = fb;
        } else {
            P[b] = fa;
        }
    }
}

bool same_set( int a, int b ) {
    return find( a ) == find( b );
}

int main( void ) {
    string line;

    while ( getline( cin, line ) ) {
        // init
        int n, m;
        Edges E;

        // input
        if ( line == "0" ) {
            break;
        }
        {
            istringstream is( line );
            is >> n;
        }
        {
            getline( cin, line );
            istringstream is( line );
            is >> m;
        }
        for ( int i = 0; i < m; i++ ) {
            getline( cin, line );
            replace( line.begin(), line.end(), ',', ' ' );
            int a, b, c;
            istringstream is( line );
            is >> a >> b >> c;

            PIP edge( c / 100, PII( a, b ) );
            E.push_back( edge );
        }

        // proc
        int answer = 0;
        init( n );

        sort( E.begin(), E.end() );
        for ( int i = 0; i < m; i++ ) {
            int a = E[i].second.first;
            int b = E[i].second.second;
            int c = E[i].first;

            if ( !same_set( a, b ) ) {
                answer += c - 1;
                merge( a, b );
            }
        }

        // output
        cout << answer << endl;
    }
    return 0;
}