#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>

using namespace std;
typedef pair<int, int> P;
static const int INF = 999999;
struct SEdge
{
	int To;
	int Cost;
};
int V, E;
vector<int> mincost;
vector< vector<SEdge> > G;
bool used[128];

int Prim()
{
	fill(used, used + V, false);
	fill(mincost.begin(), mincost.end(), INF);
	mincost[0] = 0;
	priority_queue<P, vector<P>, greater<P> > PQue;
	PQue.push(P(0, 0));
	int res = 0;
	while(!PQue.empty())
	{
		P p = PQue.top();
		PQue.pop();
		int v = p.second;
		if(mincost[v] < p.first || used[v])
		{
			continue;
		}
		used[v] = true;
		res += p.first;
		for(int i = 0; i < G[v].size(); ++i)
		{
			SEdge e = G[v][i];
			if(mincost[e.To] > e.Cost)
			{
				mincost[e.To] = e.Cost;
				PQue.push(P(mincost[e.To], e.To));
			}
		}
	}
	return(res);
}

void solve()
{
	while(cin >> V, V)
	{
		cin >> E;
		mincost.resize(V);
		G.resize(V);
		for(int i = 0; i < E; ++i)
		{
			int From, To, Cost;
			scanf("%d,%d,%d", &From, &To, &Cost);
			SEdge e1, e2;
			e1.To = To;
			e2.To = From;
			e1.Cost = e2.Cost = Cost;
			G[From].push_back(e1);
			G[To].push_back(e2);
		}
		cout << Prim() / 100 - (V - 1)<< endl;
	}
}

int main()
{
	solve();
	return(0);
}