/* Minimum Spanning Tree */

#include<queue>
#include<cstdio>
#include<vector>
#include<climits>
#include<iostream>

#define	mp(a,b)	make_pair((a),(b))
#define	dis		first
#define	node	second

using namespace std;

typedef	pair<int,int>	pii;
typedef	pair<int,pii>	pipii;

vector<int> mst;

int UF_root(int i)
{
	if(mst[i]==-1)	return i;
	return mst[i]=UF_root(mst[i]);
}

bool UF_find(int i,int j)
{
//cout<<"root"<<i<<"="<<UF_root(i)<<" root"<<j<<"="<<UF_root(j)<<endl;
	return UF_root(i)==UF_root(j);
}

void UF_union(int i,int j)
{
	mst[j]=i;
}

int main()
{
	for(int n;cin>>n,n;){
		mst=vector<int>(n,-1);	// initial forest has n trees

		priority_queue< pipii,vector<pipii>,greater<pipii> > pq;
		int m;	cin>>m;
		while(m--){
			int a,b,dis;
			scanf("%d,%d,%d",&a,&b,&dis);
			pq.push(mp(dis,mp(a,b)));
		}

		int total=0;
		while(!pq.empty()){
			pipii path=pq.top();	pq.pop();
/*			if(!UF_find(path.node.first,path.node.second)){
				UF_union(path.node.first,path.node.second);
printf(">%d\n",path.dis);
				total+=path.dis/100-1;
			}
printf("this step : ");
for(int i=0;i<n;i++)	printf("%d ",mst[i]);
puts("");
*/
			if(mst[path.node.first]==-1 || mst[path.node.second]==-1){
				mst[path.node.first]=1;
				mst[path.node.second]=1;
				total+=path.dis/100-1;
			}
		}

		cout<<total<<endl;
	}

	return 0;
}