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

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

bool comp( const edge& left, const edge& right ) {
    return left.cost < right.cost;
}

int rnk[100],par[100];

void init(int n){
	for(int i = 0;i < n;i++){
		rnk[i] = 0;
		par[i] = i;
	}
}

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

void unite(int a,int b){
	a = find(a);
	b = find(b);
	if(a == b) return;
	if(rnk[a] > rnk[b]){
		par[b] = a;
	}else{
		par[a] = b;
		if(rnk[a] == rnk[b]) rnk[b]++;
	}
}

int main(){
	int n,m;
	while(cin >> n,n){
		cin >> m;
		vector<edge> v;
		init(n);
		for(int i = 0;i < m;i++){
			int a,b,c;
			scanf("%d,%d,%d",&a,&b,&c);
			v.push_back({a,b,c / 100 - 1});
		}
		sort(v.begin(),v.end(),comp);
		int res = 0;
		for(int i = 0;i < m;i++){
			edge e = v[i];
			if(find(e.to) == find(e.from)) continue;
			unite(e.to,e.from);
			res += e.cost;
		}
		cout << res << endl;
	}
	return 0;
}