#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef struct{
	int cost,v,u,par;
}wa;
wa way[300];
int compare(const wa& a,const wa& b){
	return a.cost<b.cost;
}
int find(int t){
	if(way[t].par==t)
	return t;
	else return find(way[t].par);
}
int same(int x,int y){
	return find(x)==find(y);
}
void unite(int x,int y){
	way[x].par=find(way[y].par);
}
int main(){
	int n,m,ans,x,y,c,num;
	while(cin>>n,n){
		cin>>m;
		ans=0;
		num=0;
		for(int i=0;i<m;i++){
			scanf("%d,%d,%d",&x,&y,&c);
			way[i].v=x;
			way[i].u=y;
			way[i].cost=c;
		}
		sort(way,way+m,compare);
		for(int i=0;i<m;i++)
			way[i].par=i;
		for(int i=0;i<m;i++){
			if(!same(way[i].v,way[i].u)){
			unite(way[i].v,way[i].u);
				num++;
			ans+=way[i].cost;
			}
		}
			
		
		cout<<ans/100-num<<endl;
	}
	return 0;
}