#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef pair<int, int>P;

int main() {
	int n, m;
	while (scanf("%d", &n), n) {
		scanf("%d", &m);
		vector<P>E[100];
		bool used[100]{};
		rep(i, m) {
			int a, b, d; scanf("%d,%d,%d", &a, &b, &d);
			E[a].push_back(P(d, b)); E[b].push_back(P(d, a));
		}
		priority_queue<P, vector<P>, greater<P>>que;
		int ans = 0;
		que.push(P(0, 0));
		while (!que.empty()) {
			P p = que.top(); que.pop();
			if (used[p.second])continue;
			used[p.second] = true;
			ans += max(0, p.first / 100 - 1);
			for (P v : E[p.second])que.push(P(v.first, v.second));
		}
		printf("%d\n", ans);
	}
}