#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
using namespace std;

int par[120];
int rnk[120];
struct edge { int u, v, cost; };
bool comp(const edge&e1, const edge& e2) {
	return e1.cost < e2.cost;
}

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

int find(int a) {
	if (par[a] == a)return a;
	else return par[a] = find(par[a]);
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (rnk[x] < rnk[y])par[x] = y;
	else {
		par[y] = x;
		if (rnk[x] == rnk[y])rnk[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}
int main() {
	int n, m;
	while (cin >> n, n) {
		cin >> m;
		edge es[10000];
		for (int i = 0;i < m;i++) {
			int a, b, c;
			scanf("%d,%d,%d", &a, &b, &c);
			es[i].cost = c;
			es[i].u = b;
			es[i].v = a;
		}
		int ans =0;
		sort(es, es + m, comp);
		init(n);
		for (int i = 0;i < m;i++) {
			edge e = es[i];
			if (!same(e.u, e.v)) {
				unite(e.u, e.v);
				ans += e.cost / 100 - 1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}