#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
using namespace std;
int cost[100][100];
const int INF = 1000000;
int prim(int n,int s){
	typedef pair<int,int> P;
	bool ischeck[n];
	int mincost = 0;
	priority_queue<P,vector<P>,greater<P> > pq;
	P p,tp;
	for(int i = 0;i < n;++i){
		ischeck[i] = false;
		if(cost[s][i] != INF){
			p.first = cost[s][i];
			p.second = i;
			pq.push(p);
		}
	}
	ischeck[s] = true;
	while(!pq.empty()){
		p = pq.top();
		pq.pop();
		if(ischeck[p.second]) continue;
		else{
			ischeck[p.second] = true;
			mincost += p.first;
			for(int i = 0;i < n;++i){
				if(cost[p.second][i] != INF){
					tp.first = cost[p.second][i];
					tp.second = i;
					pq.push(tp);
				}
			}
		}
	}
	return mincost;
}
int main(){
	int n,m,a,b,c;
	while(cin >> n,n){
		for(int i = 0;i < 100;++i){
			for(int j = 0;j < 100;++j){
				cost[i][j] = INF;
			}
		}
		cin >> m;
		for(int i = 0;i < m;++i){
			scanf("%d,%d,%d",&a,&b,&c);
			cost[a][b] = c / 100 - 1;
		}
		cout << prim(n,0) << endl;
	}
	return 0;
}