#include<iostream>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e6
using namespace std;

int dist[200][200];
int mincost[200];
bool used[200];
int n,m,a,b,d;
	
int prim(){
	int ans=0;
	rep(i,n){mincost[i]=INF;used[i]=false;}
	mincost[0]=0;
	while(1){
		int v=-1;
		rep(u,n)if(!used[u] && (v==-1 || mincost[u]<mincost[v]))v=u;
		if(v==-1)break;
		used[v]=true;
		ans+=mincost[v];
		rep(u,n)mincost[u]=min(mincost[u],dist[v][u]);
	}
	return ans;
}

int main(){
	while(cin>>n,n){
		cin>>m;
		rep(i,n)rep(j,n)dist[i][j]=(i==j)?0:INF;
		rep(i,m){scanf("%d,%d,%d",&a,&b,&d);dist[a][b]=dist[b][a]=d/100-1;}
		cout<<prim()<<endl;
	}
	return 0;
}