#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <queue>
using namespace std;

#define MAXV 1000000000
#define MOD 1000000007
using ll = long long;

bool operator<(const pair<int, int>& a, const pair<int, int>& b) {
	if (a.first == b.first) {
		return a.second < b.second;
	}
	return a.first < b.first;
}

struct Node {
	int to, cost;
};

int main() {

	int N;
	while (cin >> N) {
		if (N == 0) break;

		int m; cin >> m;
		vector<vector<Node>> G(110);
		int mincost[110];
		bool used[110];

		for (int i = 0; i < N; ++i) {
			mincost[i] = 1e9;
			used[i] = false;
		}
		for (int i = 0; i < m; ++i) {
			int a, b, d;
			scanf("%d,%d,%d", &a, &b, &d);

			Node e1, e2;
			e1.to = a;
			e2.to = b;
			
			d /= 100;
			d--;
			e1.cost = e2.cost = d;

			G[a].push_back(e2);
			G[b].push_back(e1);
		}

		priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;

		mincost[0] = 0;

		q.push({ 0, 0 }); //最小コスト 現在位置
		int res = 0;

		while (q.size()) {
			pair<int, int> p = q.top();
			q.pop();

			int v = p.second;
			if (used[v]) continue;

			used[v] = true;
			res += p.first;
			for (int i = 0; i < G[v].size(); ++i) {
				Node e = G[v][i];
				if (used[e.to]) continue;
				q.push({ e.cost, e.to });
			}
		}
		cout << res << endl;
	}
	int a; cin >> a;
}
