#include <iostream>

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int prim(int n)
{
	int cost[101][101];
	int mincost[101];
	int used[101] = {};
	int res = 0;

	rep(i,n)
	{
		mincost[i] = 1000000;
		rep(j,n)
		{
			cost[i][j] = 1000000;
		}
	}
	
	int m;
	cin >> m;

	rep(i,m)
	{
		int a,b,d;
		char c1,c2;
		cin >> a >> c1 >> b >> c2 >> d;
		cost[b][a] = cost[a][b] = d/100 -1;
	}

	mincost[0] = 0;
	while(true)
	{
		int  v = -1;
		rep(u,n)
		{
			if(!used[u] && (v == -1 || mincost[u] < mincost[v]))
			{
				v = u;
			}
		}

		if(v == -1) break;

		used[v] = 1;
		res += mincost[v];
		rep(i,n)
		{
			mincost[i] = min(mincost[i],cost[v][i]);
		}
	}

	return res;
}

int main()
{
	int n;
	while(cin >> n && n)
	{
		cout << prim(n) << endl;
	}
	return 0;
}