//0072
//vñFÅ¬SæØ
//QlFhttp://www.deqnotes.net/acmicpc/prim/

#include<stdio.h>
#include<vector>
#include<queue>
#include<utility>
#include<functional>
using namespace std;


int main(void)
{
	int n, m;
	const int N = 100;
	const int INVALID_VALUE = -1;
	int cost[N][N];

	while(scanf("%d", &n), n)
	{
		scanf("%d", &m);
		int a, b, d;
		int i, j;
		//¢Á½ñ·×ÄÌ¹Ìèðú»·é
		//©ª©gÖÌ¹ÌèÍ0¾¯ÇA¡ñÍl¶·éKvÍ³¢H
		for(i = 0; i < N; ++i)
			for(j = 0; j < N; ++j)
				cost[i][j] = INVALID_VALUE;
		for(i = 0; i < m; ++i)
		{
			scanf("%d,%d,%d", &a, &b, &d);
			cost[a][b] = cost[b][a] = d;
		}

		typedef pair<int, int> P;	//<distance, toIndex>@£Å\[g·é½ßOÉ
		//¸ÉDæxÂ«ÌL[
		//½ÅftHgÍ~ÈÌæ
		priority_queue<P, vector<P>, greater<P> > q;	//>>¾ÆAOJÉG[Hç¢Üµ½BÆ¢¤©AÊÍG[Hç¤àÌ¶áH
		//»Ì¸_ÍÚ±³êÄ¢Ü·©H
		bool isConnected[N] = {false};

		int totalDistance = 0;	//Å¬ØÌ£

		//Æè ¦¸ê0©çnßæ¤
		q.push(P(0, 0));	//make_pairÅâÁ½çB¾Æ¢íê½B0Ì¹¢H
		while(!q.empty())
		{
			P p = q.top();
			q.pop();
			//·ÅÉÂÈªÁÄ¢é¸_¾Á½ç½àµÈ¢
			if(isConnected[p.second])
				continue;
			//»ÌÓðÚ±µÜ·
			isConnected[p.second] = true;
			totalDistance += p.first;
			//ÌÓðÚ±µÜ·
			for(i = 0; i < N; ++i)
			{
				if(cost[p.second][i] != INVALID_VALUE)	//»ÌæÖÌ¹Í¶ÝµÜ·©
					q.push( P(cost[p.second][i], i) );	//±±Ímake_pair()ÅàG[ÉÈçÈ¢¯êÇ
			}
		}

		//UÌÂÍAijÕÌÓ|1jÂ­È­A»µÄ100m¨«ÉÉu©êÄ¢é
		printf("%d\n", (totalDistance/100)-(n-1));
	}
	return 0;
}