#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vii;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 

const int MAX_E = 300100;
const int MAX_V = 100100;
 
int par_uft[MAX_V];
int rank_uft[MAX_V];
 
void init_uft(int n) {
	int i;
	for (i = 0; i < n; i++) {
		par_uft[i] = i;
		rank_uft[i] = 0;
	}
}
 
int find_uft(int x) {
	if (par_uft[x] == x) {
		return x;
	}
	else {
		return par_uft[x] = find_uft(par_uft[x]);
	}
}
 
void unite_uft(int x, int y) {
	x = find_uft(x);
	y = find_uft(y);
	if (x == y)return;
 
	if (rank_uft[x] < rank_uft[y]) {
		par_uft[x] = y;
	}
	else {
		par_uft[y] = x;
		if (rank_uft[x] == rank_uft[y]) {
			rank_uft[x]++;
		}
	}
}
 
bool same_uft(int x, int y) {
	return find_uft(x) == find_uft(y);
}
 
 
 
struct edge { int u, v, cost; };
 
bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}
 
edge es[MAX_E];
int V, E;
 
ll kruskal() {
	sort(es, es + E, comp);
	init_uft(V);
	ll res = 0LL;
	for (int i = 0; i < E; i++) {
		edge e = es[i];
		if (!same_uft(e.u, e.v)) {
			unite_uft(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}


int main(){
	char c;
	int a,b,d;
	while(cin>>V>>E){
		if(E==0)break;
		rep(i,E){
			cin>>a>>c>>b>>c>>d;
			d/=100;
			d--;
			if(a>b){
				int t=a;
				a=b;
				b=t;
			}
			es[i].u=a;
			es[i].v=b;
			es[i].cost=d;
		}
		cout<<kruskal()<<endl;
	}

}