#include <stdio.h>
#include <algorithm>

#define REP(i,n) for(int i=0;i<(n);i++)

#define INF 1e9
#define MAX_N 100

int n, m;
int cost[MAX_N][MAX_N];
bool used[MAX_N];
int mincost[MAX_N];

using namespace std;

int prim(void)
{
    //init
    REP(i,n){
        used[i] = false;
        mincost[i] = INF;
    }
    //start from 0th vertex
    mincost[0] = 0; 
    //search
    int dist = 0;
    while(true){
        //search the edge with minimum cost
        int v = -1;
        REP(u,n) if(!used[u] && (v==-1||mincost[u]<mincost[v])) v = u;
        if(v == -1) break;
        //set v as used vertex
        used[v] = true;
        dist += mincost[v];
        //update minimum cost
        REP(u,n) mincost[u] = min(mincost[u], cost[v][u]);
    }
    return dist;
}

void solve(void)
{
    while(true){
        scanf("%d", &n);
        if(n==0) return;
        scanf("%d", &m);
        REP(i,n) REP(j,n) cost[i][j] = INF;
        REP(i,m){
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            cost[b][a] = cost[a][b] = d/100-1;
        } 
        printf("%d\n", prim());
    }
}

int main(void)
{
    solve();
    return 0;
}