#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#define p pair<int,int>
#define P pair<int,p>
using namespace std;

P g[100000];
int Par[100000], Rank[100000];
int saiki(int a) {
	if (Par[a] == a)return a;
	return Par[a] = saiki(Par[a]);
}
void unite(int a, int b) {
	a = saiki(a);
	b = saiki(b);
	if (Rank[a] > Rank[b]) {
		Par[b] = a;
	}
	else if (Rank[a] < Rank[b]) {
		Par[a] = b;
	}
	else {
		Par[b] = a;
		Rank[a]++;
	}
}
int main() {
	int a, b;
	while (cin >> a, a) {
		cin >> b;
		for (int c = 0; c < b; c++) {
			int d, e, f;
			scanf("%d,%d,%d", &d, &e, &f);
			g[c] = P(f, p(d, e));
		}
		for (int c = 0; c < a; c++) {
			Par[c] = c;
			Rank[c] = 0;
		}
		sort(g, g + b);
		int ans = 0;
		for (int i = 0; i < b; i++) {
			if (saiki(g[i].second.first) != saiki(g[i].second.second)) {
				ans += g[i].first / 100 - 1;
				unite(g[i].second.first, g[i].second.second);
			}
		}
		cout << ans << endl;
	}
}