#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < k; i++)
typedef long long ll;
typedef unsigned long long ull;
int cost[128][128];
int mincost[128];
bool used[128];
int V,E;
void init(){
	rep(i,V)rep(j,V)cost[i][j] = INF;
	fill(mincost,mincost+V,INF);
	fill(used,used+V,false);
}
int prim(){
	mincost[0] = 0;
	int res = 0;
	while(true){
		int v = -1;
		rep(u,V)if(!used[u] && (v == -1 || mincost[u] < mincost[v]))v = u;
		if(v == -1)break;
		used[v] = true;
		res += mincost[v];
		rep(u,V)mincost[u] = min(mincost[u],cost[v][u]);
	}
	return res;
}
int main(){
	int n,m;
	while(scanf("%d",&n),n){
		scanf("%d",&m);
		V = n;
		init();
		rep(i,m){
			int from,to,pay;
			scanf("%d,%d,%d",&from,&to,&pay);
			cost[from][to] = pay-100;
			cost[to][from] = pay-100;
		}
		int ans = prim();
		printf("%d\n",ans/100);
	}
	return 0;
}