#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};

int find(vector<int> &u, int &x){
	return x == u[x] ? x : find(u, u[x]);
}

int main(){
	int n, m, a, b, d, c;
	for(;;){
		scanf("%d",&n);
		if(!n)break;
		
		vector<int> u(n);
		for(int i = 0; i < n; i++) u[i] = i;
		
		scanf("%d",&m);
		vector< pair<int, pair<int, int> > > v;
		for(int i = 0; i < m; i++){
			scanf("%d,%d,%d", &a, &b, &d);
			v.push_back( make_pair(d / 100 - 1, make_pair(min(a, b), max(a, b))));
		}
		sort(v.begin(), v.end());
		
		c = 0;
		for(int i = 0; i < m; i++){
			a = find(u,u[v[i].second.first]);
			b = find(u,u[v[i].second.second]);
			if(a != b){
				u[v[i].second.first] = u[v[i].second.second] = a;
				c += v[i].first;
			}
		}
		printf("%d\n",c);
	}
	
	return 0;
}