#include <iostream>
#include <algorithm>
#include <cstdio>
const int INF = 10000000;

int main(){
	int n, m;
	while(std::cin >> n, n){
		std::cin >> m;
		int cost[100][100];
		for(int i=0;i<10000;i++){
			cost[i/100][i%100] = INF;
		}

		for(int i=0;i<m;i++){
			int a, b, d;
			scanf("%d,%d,%d", &a, &b, &d);
			cost[a][b] = d / 100 - 1;
			cost[b][a] = d / 100 - 1;
		}
		int mincost[100];
		bool used[100];
		int res = 0;

		for(int i=0;i<100;i++){
			mincost[i] = INF;
			used[i] = false;
		}
	
		mincost[0] = 0;
		while(1){
			int v = -1;
			for(int u=0;u<n;u++){
				if(!used[u] && (v == -1 || mincost[u] < mincost[v]))
					v = u;
			}
			if(v == -1)break;
			used[v] = true;
			res += mincost[v];

			for(int u=0;u<n;u++){
				mincost[u] = std::min(mincost[u], cost[v][u]);
			}
		}

		std::cout << res << std::endl;
	}
}