#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;

typedef long long ll;

struct Edge { int from, to, dis; };

bool comp(const Edge& e1, const Edge& e2) {
	return e1.dis < e2.dis;
}

vector<Edge> es;
int V, E;

int *par;
int *rank_;

void init(int n) {
	par = new int[n];
	rank_ = new int[n];
	for (int i = 0; i < n; i++) {
		par[i] = i;
		rank_[i] = 0;
	}
}

void fin() {
	delete[] par;
	delete[] rank_;
}

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 (rank_[x] < rank_[y]) {
		par[x] = y;
	} else {
		par[y] = x;
		if (rank_[x] == rank_[y]) rank_[x]++;
	}
}

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

ll kruskal() {
	sort(es.begin(), es.end(), comp);
	init(V);
	ll res = 0;
	for (int i = 0; i < E; i++) {
		Edge e = es[i];
		if (!same(e.from, e.to)) {
			unite(e.from, e.to);
			res += e.dis;
		}
	}
	fin();
	return res;
}

int main() {
	while (1) {
		cin >> V;
		if (V == 0)
			break;
		cin >> E;
		for (int i = 0; i < E; i++) {
			Edge e;
			scanf("%d,%d,%d\n", &e.from, &e.to, &e.dis);
			es.push_back(e);
		}
		cout << kruskal() / 100 - (V - 1) << endl;
	}

	return 0;
}