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

const int inf = 1 << 29;

class Edge {
public:
    int c, i;
    Edge(int cc, int ii) {
        c = cc;
        i = ii;
    }
    friend bool operator< (const Edge &e1, const Edge &e2) {
        return (e1.c > e2.c) || (e1.c == e2.c && e1.i > e2.i);
    }
};

class Node {
public:
    vector<pair<int, int> > tos;
    int i;
    bool d;
};

int n;
vector<Node> ns;

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

int main() {
    while (cin >> n, n) {
        int m;
        cin >> m;
        ns.resize(n);
        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 << run() << endl;;
    }
}