#include <bits/stdc++.h>
using namespace std;

struct EDGE
{
	int from, to, cost;
	EDGE(int a, int b, int c){
		from = a;
		to = b;
		cost = c;
	}
	bool operator < (const EDGE& t) const {
		return cost < t.cost;
	}
};

vector<EDGE> v;
int par[100];

void init()
{
	v.clear();
	for (int i = 0; i < 100; i++){
		par[i] = i;
	}
}

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

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

void _union(int x, int y)
{
	x = find(x);
	y = find(y);
	if (x == y) return;
	par[x] = y;
}

int main()
{
	int n;
	while (scanf("%d", &n), n){
		init();
		int m;
		scanf("%d", &m);
		for (int i = 0; i < m; i++){
			int a, b, c;
			scanf("%d,%d,%d", &a, &b, &c);
			c = c / 100 - 1;
			
			v.push_back(EDGE(a, b, c));
			v.push_back(EDGE(b, a, c));
		}
		sort(v.begin(), v.end());
		int res = 0;
		for (int i = 0; i < v.size(); i++){
			EDGE& e = v[i];
			if (same(e.from, e.to)) continue;
			_union(e.from, e.to);
			res += e.cost;
		}
		printf("%d\n", res);
	}
	
	return 0;
}