#include <iostream>

using namespace std;

int cost[1000][1000];
int mincost[1000];
char used[1000];
int V;



int prim(void)
{
    int i;
    int res;
    int u, v;
    
    for (i = 0; i < V; i++){
        mincost[i] = 1000000000;
        used[i] = 0;
    }
    
    mincost[0] = 0;
    res = 0;
    
    while (1){
        v = -1;
        for (u = 0; u < V; u++){
            if (!used[u] && (v == -1 || mincost[u] < mincost[v])){
                v = u;
            }
        }
        
        if (v == -1){
            break;
        }
        used[v] = 1;
        res += mincost[v];
        
        for (u = 0; u < V; u++){
            mincost[u] = min(mincost[u], cost[v][u]);
        }
    }
    return (res);
}

int main(void)
{
    int num, from, to, dist;
    int ans;
    int i, j;
    
    while (1){
        scanf("%d", &V);
        if (V == 0){
            break;
        }
        scanf("%d", &num);
        
        for (i = 0; i < V; i++){
            for (j = 0; j < V; j++){
                cost[i][j] = 1000000000;
            }
        }
        
        for (i = 0; i < num; i++){
            scanf("%d,%d,%d", &from, &to, &dist);
            cost[from][to] = cost[to][from] = (dist / 100) - 1;
        }
        ans = prim();
        printf("%d\n", ans);
    }
    return (0);
}