#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
static const int INF = 999999;
struct SEdge
{
	int From;
	int To;
	int Cost;
};
int V, E;
vector<SEdge> Edge;

vector<int> par;
vector<int> rank;

void init(int n)
{
	par.clear();
	rank.clear();
	par.resize(n);
	rank.resize(n);
	for(int i = 0; i < n; ++i)
	{
		par[i] = i;
		rank[i] = 0;
	}
}

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));
}

bool comp(const SEdge& e1, const SEdge& e2)
{
	return(e1.Cost < e2.Cost);
}

int Kruskal()
{
	init(V);
	sort(Edge.begin(), Edge.end(), comp);
	int res = 0;
	for(int i = 0; i < E; ++i)
	{
		SEdge e = Edge[i];
		if(!same(e.From, e.To))
		{
			unite(e.From, e.To);
			res += e.Cost;
		}
	}
	return(res);
}

void solve()
{
	while(cin >> V, V)
	{
		cin >> E;
		Edge.clear();
		Edge.resize(E);
		for(int i = 0; i < E; ++i)
		{
			SEdge e;
			scanf("%d,%d,%d", &e.From, &e.To, &e.Cost);
			e.Cost = e.Cost / 100 - 1;
			Edge[i] = e;
		}
		cout << Kruskal() << endl;
	}
}

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