#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;

/** Problem0072 : Carden Lantern **/
int n, m;
int cost[100][100];
int mincost[100];
bool used[100];

// 最小全域木を求める : プリム法
int prim()
{
	rep(i, n) {
		mincost[i] = INF;
		used[i] = false;
	}
	mincost[0] = 0;
	int res = 0;
	
	while (1) {
		int v = -1;
		for (int u=0; u<n; u++) {
			if (!used[u] && (v == -1 || mincost[u]<mincost[v])) v=u;
		}
		
		if (v==-1) break;
		used[v] = true;
		res += mincost[v];
		
		rep(u, n)
			mincost[u] = min(mincost[u], cost[v][u]);
	}
	return res;
}

int main()
{
	char ca;
	
	while (cin>>n, n) {
		cin >> m;
		fill(cost[0], cost[0]+100*100, INF);
		rep(i, m) {
			int a, b, c;
			cin >> a >> ca >> b >> ca >> c;
			cost[a][b] = c/100-1;
			cost[b][a] = c/100-1;
		}
		
		cout << prim() << endl;
	}
	return 0;
}