#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

struct Edge { int from, to, cost; };
bool comp(const Edge& e1, const Edge& e2) {
	return e1.cost < e2.cost;
}

struct UnionFind {
	vector<int> par, rank;
	
	UnionFind() {}
	UnionFind(int n) {
		init(n);
	}
	
	int init(int n) {
		par.resize(n);
		rank.resize(n, 0);
		REP(i, n) par[i] = i;
	}
	
	int find(int x) {
		if (par[x] == x) return x;
		else 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);
	}
};

int main() {
	while (true) {
		int n, m;
		cin >> n;
		if (n == 0) break;
		cin >> m;
		
		UnionFind uf(n);
		vector<Edge> v(m);
		
		REP(i, m) {
			int a, b, c;
			scanf("%d,%d,%d", &a, &b, &c);
			v[i].from = a;
			v[i].to = b;
			v[i].cost = c;
		}
		sort(v.begin(), v.end(), comp);
		
		int ans = 0;
		REP(i, m) {
			Edge e = v[i];
			if (! uf.same(e.from, e.to)) {
				uf.unite(e.from, e.to);
				ans += e.cost / 100 - 1;
			}
		}
		
		cout << ans << endl;
	}
	return 0;
}