#include<iostream>
#include<algorithm>
using namespace std;

const int MAX_N = 10000;
int Par[MAX_N];
int Rank[MAX_N];

void init_union_find(int n){
	for(int i=0; i<n; ++i){
		Par[i] = i;
		Rank[i] = 0;
	}
}

int find(int x){
	if(Par[x] == x){
		return x;
	}else {
		return Par[x] = find(Par[x]);
	}
}

void unite(int x, int y){
	x = find(x);
	y = find(y);

	if(x == y)
		return ;

	if(Rank[x] < Rank[y]){
		Par[x] = y;
	} else{
		Par[y] = x;
		if(Rank[x] == Rank[y]){
			++Rank[x];
		}
	}
}

bool same(int x, int y){
	return find(x) == find(y);
}

struct edge {
	int from,
		to,
		cost;
};

bool comp(const edge& e1, const edge& e2){
	return e1.cost < e2.cost;
}

const int MAX_E = 10000;
edge es[MAX_E];
int V, E;

int kruskal(void){
	sort(es, es + E, comp);
	init_union_find(V);

	int res = 0;
	for(int i=0; i<E; ++i){
		edge e = es[i];
		if(!same(e.from, e.to)){
			unite(e.from, e.to);
			res += e.cost / 100 - 1;
		}
	}

	return res;
}

int main(void){
	while(true){
		cin >> V;
		if(V == 0)
			break;
		cin >> E;

		char d;
		for(int i=0; i<E; i++){
			cin >> es[i].from >> d >> es[i].to >> d >> es[i].cost;
		}

		cout << kruskal() << endl;
	}
}