#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>

#define rep(i,n)	for(int i = 0;i < n;i++)
#define rep2(i,n)	for(int i = 1;i <= n;i++)
#define each(i,x)	for(auto & i : x)

using namespace std;

struct edge
{
	edge(int _s,int _t,int _cost)
	{
		s = _s;t = _t;cost = _cost;
	}
	int s;
	int t;
	int cost;
};

bool operator<(const edge & x,const edge & y)
{
	return x.cost < y.cost;
}

int uf_f(vector<int> & t,int i)
{
	if(t[i] != i)
		t[i] = uf_f(t,t[i]);
	return t[i];
}

void uf_u(vector<int> & t,int i,int j)
{
	int p1 = uf_f(t,i);
	int p2 = uf_f(t,j);
	t[i] = t[p1] = t[p2];
}

int main()
{
	int n,m;
	cin >> n;
	while(n)
	{
		cin >> m;
		vector<edge> eary;
		rep(i,m)
		{
			int a,b,d;
			//cin >> a >> b >> d;
			string s;
			cin >> s;
			rep(j,s.size())
			{
				if(s[j] == ',')
					s[j] = ' ';
			}
			stringstream ss;
			ss << s;
			ss >> a >> b >> d;
			eary.push_back(edge(a,b,d));
		}
		sort(eary.begin(),eary.end());
		vector<int> uft(n);
		rep(i,n)
		{
			uft[i] = i;
		}
		int j = 0;
		int sd = 0;
		rep(i,eary.size())
		{
			int a = eary[i].s;
			int b = eary[i].t;
			int d = eary[i].cost;
			if(uf_f(uft,a) != uf_f(uft,b))
			{
				j++;
				uf_u(uft,a,b);
				sd += d/100-1;
			}
			if(j == n-1)
				break;
		}
		cout << sd << endl;
		cin >> n;
	}
	return 0;
}