#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>

using namespace std;

const int MAX_V = 10000;
const int INF = 1 << 28;

struct edge { int to, cost; };
typedef pair<int, int> P;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];
bool used[MAX_V];

int prim(){
	priority_queue<P, vector<P>, greater<P> > que;
	//cout << "V = " << V << endl;
	fill(d, d + V, INF);
	fill(used, used + V, false);
	d[0] = 0;
	que.push(P(0, 0));
	int res = 0;
	while(!que.empty()){
		P p = que.top(); que.pop();
		//cout << p.first << ' ' << p.second << endl;
		if(used[p.second]) continue;
		used[p.second] = true;
		res += p.first;
		int v = p.second;
		if(d[v] < p.first) continue;
		for(int i=0;i<G[v].size();i++){
			edge e = G[v][i];
			//cout << e.to << ' ' << e.cost << ' ' << d[e.to] << endl;
			if(d[e.to] > e.cost){
				d[e.to] = e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
	return res;
}

int main(){
	int E;
	while(1){
		scanf("%d", &V);
		if(V == 0) break;
		scanf("%d", &E);
		//cin >> V >> E;
		for(int i=0;i<MAX_V;i++) G[i].clear();
		for(int i=0;i<E;i++){
			int s, t, w;
			scanf("%d,%d,%d", &s, &t, &w);
			//cout << s << ' ' << t << ' ' << w << endl;
			//cin >> s >> t >> w;
			G[s].push_back((edge){t, w});
			G[t].push_back((edge){s, w});
		}
		cout << prim() / 100 - (V - 1) << endl;
	}
	return 0;
}