#include <iostream>
#include <algorithm>

using namespace std;

const int inf = 99999;

int prim(int a[101][101], int n)
{
	int r=0;
	bool vis[101];
	int cost[101];
	
	fill(vis, vis+101, false);
	fill(cost, cost+101, inf);
	cost[0] = 0;
	
	while(1){
		int v = -1;
		
		for(int i = 0; i < n; i++){
			if(!vis[i] && (v == -1 || cost[i] < cost[v])){
				v = i;
			}
		}
		
		if(v == -1){
			break;
		}
		
		vis[v] = true;
		r += cost[v];
		
		for(int i = 0; i < n; i++){
			cost[i] = min(cost[i], a[v][i]);
		}
	}
	
	return r;
}

int main()
{
	int a[101][101], n, m, s, t, u;
	
	while(1)
	{
		cin >> n;
		if(n == 0){
			break;
		}
		fill(&a[0][0], &a[n][n], inf);
		for(int i = 0; i < n; i++){
			a[i][i] = 0;
		}
		
		cin >> m;
		while(m--){
			scanf("%d,%d,%d",&s,&t,&u);
			a[s][t] = a[t][s] = u/100;
		}
		
		cout << (prim(a, n)-(n-1)) << endl;
	}
	
	return 0;
}