#include<bits/stdc++.h>
using namespace std;
static const int MAX_N = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, m;
int dist[MAX_N][MAX_N];
int color[MAX_N], p[MAX_N], d[MAX_N];

int prim(){
	int u, mincost;
	for(int i = 0; i < n; i++){
		d[i] = INFTY; p[i] = -1; color[i] = WHITE;
	}

	d[0] = 0;

	while(1){
		mincost = INFTY;
		u = -1;
		for(int i = 0; i < n; i++){
			if(mincost > d[i] && color[i] != BLACK){
				u = i; mincost = d[i];
			}
		}
		if(u == -1) break;
		color[u] = BLACK;
		for(int v = 0; v < n; v++){
			if(color[v] != BLACK && dist[u][v] != INFTY){
				if(d[v] > dist[u][v]){
					d[v] = dist[u][v];
					p[v] = u;
					color[v] = GRAY;
				}
			}
		}
	}
	int sum = 0;
	for(int i = 0; i < n; i++){
		if(p[i] != -1) sum += dist[i][p[i]];
	}
	return sum;
}

int main(){
	while(1){
		int a, b, d;
		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				dist[i][j] = INFTY;
			}
		}
		scanf("%d", &m);
		for(int i = 1; i <= m; i++){
			scanf("%d,%d,%d", &a, &b, &d);
			dist[a][b] = dist[b][a] = d / 100 - 1;
		}

		cout << prim() << endl;
	}
	return 0;
}