#include <iostream>
#include <queue>
#include <cstdio>
#include <cstring>
#include <map>
using namespace std;
typedef pair<int,int>PAIR;//cost/pos
int main(){
	int N,M;
	while(cin>>N,N){
		cin>>M;
		int ans=0,cnt=0;
		bool flag[100]={0};
		int load[100][100];
		memset(load,-1,sizeof(load));
		for(int i=0,A,B,C;i<M;i++){
			scanf("%d,%d,%d",&A,&B,&C);
			C=C/100-1;
			load[A][B]=load[B][A]=C;
		}
		priority_queue<PAIR,vector<PAIR>,greater<PAIR> > Q;
		Q.push(make_pair(0,0));
		for(int now,cost;!Q.empty();){
			cost=Q.top().first;
			now=Q.top().second;
			Q.pop();
			if(flag[now]==0){
				flag[now]=1;
				ans+=cost;
				cnt++;
				for(int i=0;i<N;i++)if(load[now][i]>0&&flag[i]==0)Q.push(make_pair(load[now][i],i));
			}
			if(cnt==N)break;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}
