#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <functional>
using namespace std;
#define P pair<int, int>

priority_queue<P, vector<P>, greater<P> > pq;
bool f[100];
vector<P> v[100];

int prim()
{
	int cost = 0;
	f[0] = 1;
	for (int i = 0; i < v[0].size(); i++) {
		pq.push(v[0][i]);
	}
	P p;
	while (!pq.empty()) {
		p = pq.top(); pq.pop();
		if (f[p.second]) continue;
		f[p.second] = 1;
		cost += p.first;
		for (int i = 0; i < v[p.second].size(); i++) {
			pq.push(v[p.second][i]);
		}
	}
	
	return cost;
}

int main()
{	
	int n, m;
	while (cin >> n, n) {
		cin >> m;
		for (int i = 0; i < n; i++) {
			v[i].clear();
			f[i] = 0;
		}
		for (int i = 0; i < m; i++) {
			int from, to, cost;
			scanf("%d,%d,%d", &from, &to, &cost);
			cost = cost / 100 - 1;
			v[from].push_back(P(cost, to));
			v[to].push_back(P(cost, from));
		}
		cout << prim() << endl;
	}
		
	return 0;
}