#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
int n, m;

// UnionFind
#define MAXN 110
int par[MAXN], rank[MAXN];

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

int find(int x) {
    if (x == par[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 (rank[x] < rank[y]) par[x] = y;
    else {
        par[y] = x;
        if (rank[x] == rank[y]) rank[x]++;
    }
}

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

// kruskal
#define MAXM 100010
struct edge {
    int from, to, cost;
};

bool comp(const edge &e1, const edge &e2) {
    return e1.cost < e2.cost;
}

edge es[MAXM];

int kruskal(void) {
    sort(es, es+m, comp);
    init(n);
    int ret = 0;
    for (int i = 0; i < m; i++) {
        edge e = es[i];
        if (!same(e.from, e.to)) {
            unite(e.from, e.to);
            ret += e.cost / 100 - 1;
        }
    }
    return ret;
}


int main(void) {
    while (cin >> n && n) {
        cin >> m;
        for (int i = 0; i < m; i++) {
            int a, b, c;
            scanf("%d,%d,%d", &es[i].from, &es[i].to, &es[i].cost);
        }
        cout << kruskal() << endl;
    }
    return 0;
}