import std.stdio,std.string,std.conv,std.algorithm;


int cost[101][101];
int mincost[101];
int used[101] = [];

int prim(int n)
{
	int res = 0;
	foreach(i;0..n)
	{
		mincost[i] = 1000000;
		foreach(j;0..n)
		{
			cost[i][j] = 1000000;
		}
	}

	int m = readln.chomp.to!int;

	foreach(i;0..m)
	{
		string s = readln.chomp;
		string[] _s = s.split(',');
		int a = _s[0].to!int;
		int b = _s[1].to!int;
		int d = _s[2].to!int;
		cost[b][a] = cost[a][b] = d/100 - 1;
	}

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

		if(v == -1) break;

		used[v] = 1;
		res += mincost[v];
		foreach(i;0..n)
		{
			mincost[i] = min(mincost[i],cost[v
			][i]);
		}
	}
	return res;
}

int main()
{
	int n;
	while((n = readln.chomp.to!int) != 0)
	{
		prim(n).writeln;
	}
	return 0;
}