#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int,int> P;
vector<P> v[110];
bool vis[110];
priority_queue<P,vector<P>,greater<P> > Q;
int n,m;
int main(){
	while(cin>>n&&n){
	cin>>m;
	for(int i=0;i<n;i++){
		v[i].clear();
		vis[i]=false;
	}
	for(int i=0;i<m;i++){
		int a,b,c;char z;cin>>a>>z>>b>>z>>c;c=c/100-1;
		v[a].push_back(make_pair(c,b));
		v[b].push_back(make_pair(c,a));
	}
	Q.push(make_pair(0,0));int ans=0;
	while(!Q.empty()){
		int x=Q.top().first,y=Q.top().second;//y???x??§?????????
		Q.pop();
		if(vis[y])continue;vis[y]=true;ans+=x;
		for(int i=0;i<v[y].size();i++){
			Q.push(make_pair(v[y][i].first,v[y][i].second));
		}
	}
	cout<<ans<<endl;
	}
	return 0;
}