#include<iostream>
#include<cstdio>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
	for(;;){
		int n,m,sum = 0;
		cin >>n;
		if(!n){break;}
		cin >>m;
		vector<pair<int, pair<int,int> > > edge;
		bool done[100] = {false};
		for(int i=0; i<m ;i++){
			int a,b,cost;
			scanf("%d,%d,%d",&a,&b,&cost);
			edge.push_back(make_pair(cost,make_pair(a,b)));
		}
		sort(edge.begin(),edge.end());
		done[edge[0].second.first] = true;
		done[edge[0].second.second] = true;
		sum += edge[0].first/100;
		if(!(edge[0].first%100)){sum--;}
		for(int i=0; i<n-1; i++){
			for(int k=0; k<m; k++){
				if(done[edge[k].second.first]^done[edge[k].second.second]){
					sum += edge[k].first/100;
					if(!(edge[k].first%100)){sum--;}
					done[edge[k].second.first] = true;
					done[edge[k].second.second] = true;
					break;
				}
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}