#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

struct Edge
{
    int src, dist, weight;
    Edge( int src, int dist, int weight ): \
        src ( src ), dist ( dist ), weight ( weight ) { }
    bool operator< ( const Edge &rhs ) const
    {
        if ( weight != rhs.weight ) {
            return weight > rhs.weight;
        }
        if ( src != rhs.src ) {
            return src < rhs.src;
        }
        return dist < rhs.dist;
    }
};

vector< vector< Edge > > g;
int m, n;
const int MAX = 100, INF = 1e9;

int main()
{
    while ( true ) {
        cin >> n;
        if ( n == 0 )  {
            break;
        }

        // init
        g.resize( n );

        cin >> m;
        int s;
        for ( int i = 0; i < m; i++ ) {
            int a, b, dist;
            scanf ( "%d,%d,%d", &a, &b, &dist );
            g[a].push_back( Edge( a, b, ( dist / 100 ) - 1 ) );
            g[b].push_back( Edge( b, a, ( dist / 100 ) - 1 ) );
            s = a;
        }

        vector< bool > visit( n, false );
        priority_queue< Edge > que;
        que.push( Edge( -1, s, 0 ) );

        int ans = 0;
        while ( !que.empty() ) {
            Edge edge = que.top();
            que.pop();

            if ( visit[edge.dist] ) {
                continue;
            }
            visit[edge.dist] = true;

            ans += edge.weight;
            for ( int i = 0; i < g[edge.dist].size(); i++ ) {
                if ( !visit[g[edge.dist][i].dist] ) {
                    que.push( g[edge.dist][i] );
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}