#include <stdio.h>

int INF = 1 << 30;

int main(void)
{
	int n,d;
	int path[200][200];
	int x,y,cost; // 飾り
	int used[200]; // 木に入ったか
	int mincost; // 最安値
	int minnum; // 安い点
	int ans;

	scanf("%d", &n);
	while(n != 0){

		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				path[i][j] = INF;
			}
			used[i] = 0;
		}
		used[0] = 1;

		scanf("%d", &d);

		for(int i = 0; i < d; i++){
			scanf("%d,%d,%d", &x, &y, &cost);
			path[x][y] = cost;
			path[y][x] = cost;
		}
		mincost = INF + 1;
		ans = 0;

		for(int i = 0; i < n - 1; i++){
			for(int j = 0; j < n; j++){
				if(used[j]){
					for(int k = 0; k < n; k++){
						if(path[j][k] < mincost){
							if(!used[k]){
								minnum = k;
								mincost = path[j][k];
							}
						}
					}
				}
			}
			ans += (mincost - 100) / 100;
			used[minnum] = 1;
		}

		printf("%d\n",ans);
		scanf("%d", &n);
	}
	return 0;
}