#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

struct Edge { int to, cost; };
vector<vector<Edge> > G;

const int INF = 1e8;
int n, m;

void addEdge(int a, int b, int cost) {
    G[a].push_back((Edge){ b, cost });
    G[b].push_back((Edge){ a, cost });
}

int prim() {
    vector<int> mincost(n, INF);
    vector<bool> used(n, false);
    mincost[0] = 0;
    int res = 0;
    while (1) {
        int v = -1;
        for (int i=0; i<n; ++i) {
            if ( ! used[i] && (v == -1 || mincost[i] < mincost[v])) v = i;
        }
        if (v == -1) break;
        used[v] = true;
        res += mincost[v];

        for (int i=0; i<(int)G[v].size(); ++i) {
            Edge &e = G[v][i];
            mincost[e.to] = min(mincost[e.to], e.cost);
        }
    }
    return res;
}

int main() {
    while (cin >> n >> m, n) {
        G.resize(n);
        fill(G.begin(), G.end(), vector<Edge>());
        int a, b, c;
        char dlm;
        for (int i=0; i<m; ++i) {
            cin >> a >> dlm >> b >> dlm >> c;
            addEdge(a, b, c / 100 - 1);
        }
        cout << prim() << endl;
    }
    return 0;
}