#include <iostream>
#include <algorithm>
using namespace std;
const int MAX_V = 100,MAX_E = 10000;
int V,E;
class Union_Find{
private:
	int par[MAX_V],rank[MAX_V];
public:
	void init(int n);
	int find(int x);
	void unite(int x,int y);
	bool same(int x,int y);
};
void Union_Find::init(int n){
	for(int i = 0;i < n;++i){
		par[i] = i;
		rank[i] = 0;
	}
}
int Union_Find::find(int x){
	if(par[x] == x){
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
void Union_Find::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 Union_Find::same(int x,int y){
	return find(x) == find(y);
}
struct edge{
	int u,v,cost;
};
edge es[MAX_E];
bool comp(const edge& e1,const edge& e2){
	return e1.cost < e2.cost;
}
int kruskal(){
	sort(es,es + E,comp);
	Union_Find u;
	u.init(V);
	int res = 0;
	for(int i = 0;i < E;++i){
		edge e = es[i];
		if(!u.same(e.u,e.v)){
			u.unite(e.u,e.v);
			res += e.cost;
		}
	}
	return res;
}
int main(){
	edge e;
	int u,v,cost;
	char a;
	while(cin >> V,V){
		cin >> E;
		for(int i = 0;i < E;++i){
			cin >> u >> a >> v >> a >> cost;
			e.u = u;
			e.v = v;
			e.cost = (cost / 100) - 1;
			es[i] = e;
		}
		cout << kruskal() << endl;
	}
	return 0;
}