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

struct edge { int to, cost; };
vector<vector<edge>> G;
vector<bool> used;

int mst() {
    int ret = 0;
    priority_queue<pair<int,int>> q;
    q.push(make_pair(0, 0));
    while ( ! q.empty()) {
        int dist = -q.top().first;
        int v = q.top().second;
        q.pop();
        if (used[v]) continue;
        used[v] = true;
        ret += dist;
        for (int i=0; i<(int)G[v].size(); ++i) {
            if ( ! used[G[v][i].to]) {
                q.push(make_pair(-G[v][i].cost, G[v][i].to));
            }
        }
    }
    return ret;
}

int main() {
    int n, m;
    while (cin >> n, n) {
        G.clear(); G.resize(n);
        used.clear(); used.resize(n);
        cin >> m;
        int a, b, d;
        char c;
        for (int i=0; i<m; ++i) {
            cin >> a >> c >> b >> c >> d;
            G[a].push_back((edge){b, d / 100 - 1});
            G[b].push_back((edge){a, d / 100 - 1});
        }
        cout << mst() << endl;
    }
    return 0;
}