#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){	
	while(1){
	int n;
	int m;
	cin>>n;
	if(n==0)break;
	cin>>m;
	vector<vector<mp> > g(n);
	vector<bool> used(n,true);
	int cnt = 0;
	for(int i=0;i<m;i++){
		int a,b,d;
		scanf("%d,%d,%d",&a,&b,&d);
		d/=100;
		d--;
		g[a].push_back(mp(d,b));
		g[b].push_back(mp(d,a));
	}
	priority_queue<mp,vector<mp>,greater<mp> > q;
	used[0] = false;
	for(int i=0;i<g[0].size();i++){
		q.push(g[0][i]);
	}
	ll res = 0;
	while(!q.empty()){
		mp now = q.top();
		q.pop();
		if(!used[now.second])continue;
		res+=now.first;
		ll next = now.second;
		used[next] = false;
		for(int i=0;i<g[next].size();i++){
		if(used[g[next][i].second])q.push(g[next][i]);
		}

	}
	cout<<res<<endl;
	}

	return 0;
}

