#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <functional>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
//#define scanf scanf_s

struct edge{ int from, to, cost; };
int par[105];

bool comp(const edge& e1, const edge& e2)
{
	return e1.cost < e2.cost;
}

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);
	par[y] = x;
}


int main()
{
	int n, m;
	while (cin >> n >> m, n)
	{
		vector<edge> e;
		REP(i, m)
		{
			int a, b, c;
			scanf("%d,%d,%d", &a, &b, &c);
			c = c/100 - 1;
			edge tmp = { a, b, c };
			e.push_back(tmp);
		}
		sort(e.begin(), e.end(), comp);

		REP(i, 105) par[i] = i;
		int cost = 0;
		REP(i, e.size())
		{
			if (find(e[i].from) != find(e[i].to))
			{
				cost += e[i].cost;
				unite(e[i].from, e[i].to);
			}
		}
		cout << cost << endl;
	}
	return 0;
}