// 0072
#include <iostream>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

struct road{
	int dis;
	int v1;
	int v2;
};


int findSet(int x, vector<int> &p){
	if(x != p[x])
		p[x] = findSet(p[x], p);
	return p[x];
}

bool isSameSet(int x, int y, vector<int> &p){
	return findSet(x, p) == findSet(y, p);
}

void link(int x, int y, vector<int> &p, vector<int> &rank){
	if(rank[x] > rank[y]){
		p[y] = x;
	}else{
		p[x] = y;
		if(rank[x] == rank[y])
			rank[y]++;
	}
}

void unite(int x, int y, vector<int> &p, vector<int> &rank){
	link(findSet(x, p), findSet(y, p), p, rank);
}

void Sort(vector<road> &ver){
	road r;
	for(int i=0;i<ver.size();i++){
		for(int j=1;j<ver.size()-i;j++){
			if(ver[j-1].dis > ver[j].dis){
				r = ver[j-1];
				ver[j-1] = ver[j];
				ver[j] = r;
			}
		}
	}
}

int lantern(vector<road> ver){
	vector<int> rank, p;
	for(int i=0;i<ver.size();i++){
		p.push_back(i);
		rank.push_back(0);
	}

	int lan = 0;
	for(int i=0;i<ver.size();i++){
		if(!isSameSet(ver[i].v1, ver[i].v2, p)){
			lan += ver[i].dis/100-1;
			unite(ver[i].v1, ver[i].v2, p, rank);
		}
	}

	return lan;
}

int main(){
	while(1){
		int n, m, a, b, d;
		vector<road> ver;
		road v;

		cin>>n;
		if(n == 0)
			break;

		cin>>m;
		for(int i=0;i<m;i++){
			scanf("%d,%d,%d", &a, &b, &d);
			v.v1 = a;
			v.v2 = b;
			v.dis = d;
			ver.push_back(v);
		}

		Sort(ver);
		
		cout<<lantern(ver)<<endl;
	}
	return 0;
}