#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

class union_find {
private:
	vector<ll> par, sz, rank;
public:
	union_find(ll n) : par(n), sz(n), rank(n)
	{
		REP(i, n) {
			par[i] = i;
			sz[i] = 1;
			rank[i] = 0;
		}
	}
	ll find(ll x)
	{
		return par[x] == x ? x : par[x] = find(par[x]);
	}
	void unite(ll x, ll y)
	{
		x = find(x);
		y = find(y);
		if (x != y) {
			if (rank[x] < rank[y]) {
				par[x] = y;
				sz[y] += sz[x];
			} else {
				par[y] = x;
				sz[x] += sz[y];
				if (rank[x] == rank[y]) {
					rank[x]++;
				}
			}
		}
	}
	bool same(ll x, ll y)
	{
		return find(x) == find(y);
	}
	ll size(ll n)
	{
		return sz[find(n)];
	}
};
struct edge { ll from, to, cost; };
signed main()
{
	while (true) {
		ll n = in(); if (n == 0)break;
		ll  m = in();
		vector<edge>es(m);
		REP(i, m) {
			ll a, b, d;
			scanf("%lld,%lld,%lld", &a, &b, &d);
			es[i] = { a,b,d };
		}
		sort(ALL(es), [](const edge&e1, const edge&e2) {return e1.cost < e2.cost; });
		union_find uf(n);
		ll ans = 0;
		REP(i, m) {
			if (!uf.same(es[i].from, es[i].to)) {
				uf.unite(es[i].from, es[i].to);
				ans += es[i].cost / 100 - 1;
			}
		}
		cout << ans << endl;
	}
}
