#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>

using namespace std;

struct edge {
	int to, cost;
	edge(int t, int c) : to(t), cost(c) { }
};
typedef pair<int, int> P;

int prim ( int n, vector<vector<edge> >* E )
{
	vector<bool> used(n, false);

	priority_queue<P, vector<P>, greater<P> > que;
	que.push(P(0, 0));

	int res = 0;
	while (!que.empty()) {
		P p = que.top(); que.pop();

		int v = p.second;
		if (used[v]) { continue; }
		used[v] = true;
		res += max(0, p.first / 100 - 1);
		cout << "cost=" << p.first << endl;
		
		vector<edge> es = (*E)[v];
		for (int i = 0; i < es.size(); ++i) {
			edge& e = es[i];
			if (!used[e.to]) { que.push(P(e.cost, e.to)); }
		}
	}
	return res;
}

int main ( void )
{
	int n;

	while (cin >> n, n) {
		int m;
		cin >> m;

		vector<vector<edge> > E(n);

		for (int i = 0; i < m; ++i) {
			int a, b, c;
			scanf("%d,%d,%d", &a, &b, &c);

			E[a].push_back(edge(b, c));
			E[b].push_back(edge(a, c));
		}

		cout << prim(n, &E) << endl;
	}
	return 0;
}