#include <bits/stdc++.h>

using namespace std;

#define MAX 114514

int par[MAX], rnk[MAX];

void init(int N)
{
    for (int i = 0; i < N; i++) {
        par[i] = i;
        rnk[i] = 0;
    }
}

int find(int x)
{
    if (par[x] == x) {
        return x;
    }
    return par[x] = find(par[x]);
}

void unite(int x, int y)
{
    x = find(x); y = find(y);
    if (x == y) return;

    if (rnk[x] < rnk[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
}

bool same(int x, int y)
{
    return (find(x) == find(y));
}

typedef pair<int, int> pii;
typedef pair<int, pii> P;

int kruscal(P *p, int N, int M)
{
    sort(p, p + M);
    init(N);
    int res = 0;
    for (int i = 0; i < M; i++) {
        int a = p[i].second.first, b = p[i].second.second;
        if (!same(a, b)) {
            unite(a, b);
            res += p[i].first;
        }
    }
    return res;    
}

int main()
{
    int N, M;
    while (cin >> N, N) {
        cin >> M;
        P p[MAX];
        char x;
        for (int i = 0; i < M; i++) {
            int a, b, c;
            cin >> a >> x >> b >> x >> c;
            p[i] = P(c/100-1, pii(a, b));
        }
        cout << kruscal(p, N, M) << endl;
    }
    return 0;
}