#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <cstdio>
using namespace std;

typedef pair<int, int> ii;

struct Node {
    bool d;
    vector<ii> tos;
};

int n;
vector<Node> ns;

int prim() {
    for (int i = 0; i < n; i++) {
        ns[i].d = false;
    }
    priority_queue<ii, vector<ii>, greater<ii> > q;
    q.push(make_pair(0, 0));
    int ans = 0;
    while (!q.empty()) {
        ii p = q.top();
        q.pop();
        int i = p.second;
        if (ns[i].d) {
            continue;
        }
        ns[i].d = true;
        ans += p.first;
        for (vector<ii>::iterator it = ns[i].tos.begin(); it != ns[i].tos.end(); it++) {
            q.push(make_pair(it->second, it->first));
        }
    }
    return ans;
}

int main() {
    while (cin >> n, n) {
        ns.clear();
        ns.resize(n);
        int m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            int a, b, c;
            scanf("%d,%d,%d", &a, &b, &c);
            c = c / 100 - 1;
            ns[a].tos.push_back(make_pair(b, c));
            ns[b].tos.push_back(make_pair(a, c));
        }
        cout << prim() << endl;
    }
}