#include <iostream>
#include <cstdio>
#include <climits>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	int n, m;
	while(cin >> n, n) {
		cin >> m;
		int cost[100][100];
		rep(i,100) {
			rep(j,100) {
				cost[i][j] = INT_MAX;
			}
		}
		rep(i,m) {
			int s, t, len;
			scanf("%d,%d,%d", &s, &t, &len);
			len /= 100;
			cost[s][t] = len;
			cost[t][s] = len;
		}
		int dist[100];
		bool visited[100];
		rep(i,n) {
			dist[i] = INT_MAX;
			visited[i] = 0;
		}
		dist[0] = 0;
		visited[0] = 1;
		int ret = 0;
		while(1) {
			bool flag = true;
			rep(i,n) {
				if(!visited[i]) {
					flag = false;
					break;
				}
			}
			if(flag) break;
			int min = INT_MAX;
			int to;
			rep(i,n) {
				if(visited[i]) {
					rep(j,n) {
						if(!visited[j]) {
							if(cost[i][j] < min) {
								min = cost[i][j];
								to = j;
							}
						}
					}
				}
			}
			visited[to] = 1;
			ret += min;
		}
		cout << ret - n + 1 << endl;
	}
	return 0;
}