#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <set>
using namespace std;
#define MAX_V 100
#define INF 1<<30

int N, M;
int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
bool Vused[MAX_V][MAX_V];

int prim(){
	for(int i=0;i<N;i++){
		mincost[i]=INF;
		used[i] = false;
	}
	mincost[0] = 0;
	int res = 0;

	while(true){
		int v = -1;
		for(int u=0;u<N;u++){
			if(!used[u] && (v==-1 || mincost[u] < mincost[v])) v=u;
		}
		if(v == -1) break;
		used[v] = true;
		if(mincost[v] >= INF) return INF;
		res += mincost[v];
		for(int u=0;u<N;u++){
			if(mincost[u] > cost[v][u]){
				mincost[u] = cost[v][u];
			}
		}
	}
	return res;
}


main(){
	int i,j;
	while(cin >> N, N){
		for(i=0;i<N;i++){
			for(j=0;j<N;j++){
				cost[i][j] = INF;
				Vused[i][j] = false;
			}
		}
		cin >> M;
		for(i=0;i<M;i++){
			int a,b,c;
			char x;
			cin >> a >> x >> b >> x >> c;
			cost[a][b] = cost[b][a] = c/100-1;
		}
		cout << prim() << endl;
	}
	return 0;
}