#include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int par[100001], Rank[100001];

//n????´???§?????????
void init(int n) {
	rep(i, n) {
		par[i] = i;
		Rank[i] = 0;
	}
}

//??¨??????????±???????
int find(int x) {
	if(par[x] == x) return x;
	else return par[x] = find(par[x]);
}

//x??¨y????±??????????????????????
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(Rank[x] < Rank[y]) par[x] = y;
	else par[y] = x;
	if(Rank[x] == Rank[y]) ++Rank[x];
}

//x??¨y???????????????????±????????????????
bool same(int x, int y) {
	return find(x) == find(y);
}

struct edge {int u, v, cost; };
int N, M;
edge es[100000];

bool comp(const edge &a, const edge &b){
	return a.cost < b.cost;
}

int kruskal() {
	sort(es, es + M, comp);
	init(N);
	int res = 0;
	rep(i, M) {
		edge &e = es[i];
		if(!same(e.u, e.v)) {
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}

int main() {
    while(scanf("%d", &N), N) {
    	scanf("%d", &M);
    	rep(i, M) {
    		int a, b, c;
    		scanf("%d,%d,%d", &a, &b, &c);
    		c = c / 100 - 1;
    		edge tmp = {a, b, c};
    		es[i] = tmp;
    	}
        printf("%d\n", kruskal());
    }
	return 0;
}