#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

using namespace std;

#define MAX_V 100
#define INF INT_MAX / 2 - 1

int cost[MAX_V][MAX_V];
int mindis[MAX_V];
bool used[MAX_V];
int V;

void printv(string name, int v[], int len) {
	cout << name << " :";
	for (int i = 0; i < len; i++)
		cout << " " << v[i];
	cout << endl;
}

int prim() {
	fill_n(mindis, V, INF);
	fill_n(used, V, false);

	mindis[0] = 0;
	int res = 0;

	while (1) {
		int v = -1;
		for (int u = 0; u < V; u++)
			if (!used[u] && (v == -1 || mindis[u] < mindis[v]))
				v = u;
		if (v == -1)
			break;
		used[v] = true;
		if (mindis[v])
			res += mindis[v] / 100 - 1;

		for (int u = 0; u < V; u++)
			mindis[u] = min(mindis[u], cost[v][u]);
//		printv("mindis", mindis, V);
	}

	return res;
}

int main() {
	while (1) {
		for (int i = 0; i < MAX_V; i++)
			fill_n(cost[i], MAX_V, INF);
		cin >> V;
		if (V == 0) break;

		int E;
		cin >> E;
		for (int i = 0; i < E; i++) {
			int u, v, dis;
			scanf("%d,%d,%d\n", &u, &v, &dis);
			cost[u][v] = cost[v][u] = dis;
		}
		cout << prim() << endl;
	}
	return 0;
}