
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

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

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

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (rk[x] < rk[y])
		par[x] = y;
	else {
		par[y] = x;
		if (rk[x] == rk[y])rk[x]++;
	}
}

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

struct edge {
	ll u, v, cost;
};

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


edge es[110];
int n, m;

ll kruskal() {
	sort(es, es + m, comp);
	init(n);
	ll res = 0;
	for (int i = 0; i < m; i++) {
		edge e = es[i];
		if (!same(e.u, e.v)) {
			unite(e.u, e.v);
			res += (e.cost) / 100 - 1;
		}
	}
	return res;
}

int main()
{
	while (cin >> n, n) {
		cin >> m;
		for (int i = 0; i < m; i++) {
			ll a, b, d;
			scanf("%d,%d,%d", &a, &b, &d);
			es[i].u = a, es[i].v = b, es[i].cost = d;
		}
		cout << kruskal() << endl;
	}
	return	0; 
}