#include <bits/stdc++.h>

using namespace std;

const int INF = 1e9;
const int MAX_V = 100;
int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int V;

int prim() {
    fill(mincost, mincost + V, INF);
    fill(used, used + V, false);
    mincost[0] = 0;
    int res = 0;

    while (true) {
        int v = -1;
        for (int u = 0; u < V; u++)
            if (!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
        
        if (v == -1) break;
        used[v] = true;
        res += mincost[v];

        for (int u = 0; u < V; u++)
            mincost[u] = min(mincost[u], cost[v][u]);
    }

    return res;
}

int main() {
    while (scanf("%d", &V), V) {
        int m;
        scanf("%d", &m);
                
        for (int i = 0; i < V; i++)
            fill(cost[i], cost[i] + V, INF);

        for (int i = 0; i < m; i++) {
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            cost[a][b] = cost[b][a] = d;
        }
        
        int ans = prim() / 100 - (V - 1);
        cout << ans << endl;
    }

    return 0;
}
