#include <cstdio>
#include <iostream>
#include <queue>

#define INF 1e9

struct Edge {
	int to, cost;
};
struct Node {
	int now, cost, pCost;
};
bool operator <(const Node& n1, const Node& n2) {
	return n1.cost < n2.cost;
}
bool operator >(const Node& n1, const Node& n2) {
	return n1.cost > n2.cost;
}

using namespace std;

int main() {
	int n;
	while (cin >> n, n) {
		vector<Edge> edge[100];
		int m; cin >> m;
		for (int i = 0; i < m; ++i) {
			int a, b, d;
			scanf("%d,%d,%d", &a, &b, &d);

			int c = d / 100 - 1;
			edge[a].push_back( (Edge){ b, c } );
			edge[b].push_back( (Edge){ a, c } );
		}

		priority_queue<Node, vector<Node>, greater<Node> > Q; Q.push( (Node){ 0, 0, 0 } );
		bool f[100] = {0};
		int ans = 0;
		while ( !Q.empty() ) {
			Node node = Q.top(); Q.pop();
			if (f[node.now]) continue;
			f[node.now] = true;

			ans += node.pCost;

			for (int i = 0; i < edge[node.now].size(); ++i) {
				Edge& e = edge[node.now][i];
				Q.push( (Node){ e.to, e.cost, e.cost } );
			}
		}
		cout << ans << endl;
	}
}