#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;
#define MAX_A 200
#define MAX_E 10100

struct edge{int s, v, cost;};

int e, v;
edge es[MAX_E];
int _rank[MAX_A], par[MAX_A];

bool comp(const edge& e1, const edge& e2){
	return e1.cost < e2.cost;
}

void init(int n){
	for(int i = 0; i < n; i++){
		par[i] = i;
		_rank[i] = 0;
	}
}

int find(int x){
	if(par[x] == x)return x;
	else return par[x] = find(par[x]);
}

int unite(int x, int y){
	x = find(x);
	y = find(y);
	if(_rank[x] < _rank[y]){
		par[x] = y;
	} else {
		par[y] = x;
		if(_rank[y] == _rank[x]) _rank[x]++;
	}
}

bool same(int x,int y){
	return find(x) == find(y);
}

int kraskal(){
	sort(es, es+e,comp);
	
	init(v);
	
	int sum = 0;
	
	for(int i = 0; i < e; i++){
		if(same(es[i].s, es[i].v) == false){
			// cout<<es[i].s<<" "<<es[i].v<<" "<<es[i].cost<<endl;
			sum += (es[i].cost-100)/100;
			unite(es[i].s, es[i].v);
		}
	}
	return sum;
}

int main(){
	
	while(1){
		string s, z;
		char t;
		int a[3], count = 0,  size;
		cin>>v;
		if(!v)break;
		cin>>e;
		for(int i = 0; i < e; i++){
			cin>>z;
			size = z.size();
			count = 0;
			for(int j = 0; j < size; j++){
				t = z[j];
				if(t != ',') s += t;
				if(t == ',' || j == size-1){
					a[count++] = stoi(s);
					s.clear();
				}
			}
			es[i].s = a[0];
			es[i].v = a[1];
			es[i].cost = a[2];
		}
		
		cout<<kraskal()<<endl;
		
	}
	
	
	return 0;
}
