#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

using Weight = int;
struct Edge {
	int src, dst; Weight weight;
	Edge() {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;

struct UnionFind {
	vector<int> par;
	int cnt;
	UnionFind(int size_) : par(size_, -1), cnt(size_) {}
	void unite(int x, int y) {
		if((x = find(x)) != (y = find(y))) {
			if(par[y] < par[x]) swap(x, y);
			par[x] += par[y]; par[y] = x; cnt--;
		}
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
	int size(int x) { return -par[find(x)]; }
	int size() { return cnt; }
};

bool operator < (const Edge &e, const Edge &f) { return e.weight < f.weight; }
pair<Weight, Edges> kruskal(int N, Edges es) {
	UnionFind uf(N);
	Weight total = 0; Edges T;
	for(auto &e : es) if(!uf.same(e.src, e.dst)) {
		T.push_back(e); total += e.weight; uf.unite(e.src, e.dst);
	}
	return make_pair(total, T);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, m;
	while(cin >> n >> m, n) {
		Edges G;
		for(int i = 0; i < m; i++) {
			int a, b, d;
			char c;
			cin >> a >> c >> b >> c >> d;
			G.push_back(Edge(a, b, d / 100 - 1));
		}
		sort(G.begin(), G.end());
		auto res = kruskal(n, G);
		cout << res.first << endl;
	}
}