#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

const int N_MAX = 100;
int n, m;
int edges[N_MAX][N_MAX];

int solve() {
	bool visited[n];
	int result = 0;
	memset(visited, 0, sizeof(visited));
	typedef pair<int, int> P;
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(make_pair(0, 0));
	while (!que.empty()) {
		P current = que.top();
		que.pop();
		const int cost = current.first;
		const int pos = current.second;
		if (visited[pos]) continue;
		visited[pos] = true;
		result += cost;
		for (int i = 0; i < n; i++) {
			if (edges[pos][i] != -1) {
				que.push(make_pair(edges[pos][i], i));
			}
		}
	}
	return result;
}

int main () {
	while (scanf("%d", &n), n) {
		scanf("%d", &m);
		memset(edges, -1, sizeof(edges));
		for (int i = 0; i < m; i++) {
			int a, b, d;
			scanf("%d,%d,%d", &a, &b, &d);
			edges[a][b] = edges[b][a] = d / 100 - 1;
		}
		printf("%d\n", solve());
	}
	return 0;
}