#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <bitset>
#include <string>
using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define RPA(i,s,e) for(int i=s; i<=e; i++)
#define RPD(i,s,e) for(int i=s; i>=e; i--)
#define PB(a) push_back(a)
#define MP(i,s) make_pair(i,s)
#define ALL(a) (a).begin(), (a).end()
#define PRT(a) cout << (a) << endl

typedef pair<int,int> P;

const int INF = 100000009;
int m, n;
int dist[101][101];
bool used[101];
int f, t, c;

int solve() {
	memset(used, 0, sizeof(used));

	priority_queue<P, vector<P>, greater<P> > que;
	used[0] = true;
	REP(i,m) {
		if(dist[0][i] != INF) {
			que.push(P(dist[0][i], i));
		}
	}

	int cost = 0;
	while(!que.empty()) {
		P p = que.top();
		que.pop();

		int from = p.second;
		if(used[from]) continue;
	
		used[from] = true;
		cost += p.first;
		REP(i,m) {
			if(dist[from][i] != INF && !used[i]) {
				que.push(P(dist[from][i], i));
			}
		}
	}
	return cost;
}

void coding() {
	while(scanf("%d", &m) != EOF) {
		if(m == 0) break;
		scanf("%d", &n);

		REP(i,m) {
			REP(j,m) {
				dist[i][j] = INF;
			}
		}

		REP(i,n) {
			scanf("%d,%d,%d", &f, &t, &c);
			c = c / 100 - 1;
			dist[f][t] = c;
			dist[t][f] = c;
		}
		printf("%d\n", solve());
	}
}

// #define _LOCAL_TEST

int main() {
#ifdef _LOCAL_TEST
	freopen("a.in", "r", stdin);
#endif

	coding();

#ifdef _LOCAL_TEST
	cout << endl;
	cout << "This is local test" << endl;
	cout << "Do not forget to comment out _LOCAL_TEST" << endl;
#endif
}