#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 cost[100][100];
int mincost[100];
bool used[100];
int V;

int prim(){
	rep(i,V){mincost[i]=INF;used[i]=false;}
	mincost[0]=0;
	int res=0;
	while(1){
		int v=-1;
		rep(u,V)if(!used[u] && (v==-1 || mincost[u]<mincost[v]))v=u;
		if(v==-1)break;
		used[v]=true;
		res+=mincost[v];
		mincost[v]=0;
		rep(u,V){
			mincost[u]=min(mincost[u],cost[v][u]);
		}
	}
	return res;
}

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