#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	while(1) {
		int n, m;
		int len[100][100];
		int Length[100];
		bool flag[100];
		int lantern = 0;
		int point = 0;

		// 初期化
		for(int i = 0; i < 100; i++) {
			for(int j = 0; j < 100; j++) {
				len[i][j] = -1;
			}
			Length[i] = -1;
			flag[i] = false;
		}

		cin >> n;
		if(n == 0) break;
		cin >> m;
		while(m-- > 0) {
			int from, to, L;
			scanf("%d,%d,%d", &from, &to, &L);
			len[from][to] = (L / 100) - 1;
		}

		flag[0] = true;
		for(int i = 0; i < n; i++) {
			Length[i] = len[0][i];
		}

		while(1) {
			int min = -1;
			for(int i = 0; i < n; i++) {
				if(flag[i] == false && Length[i] > 0 && (min < 0 || Length[i] < min)) {
					min = Length[i];
					point = i;
				}
			}
			flag[point] = true;
			lantern += Length[point];

			bool endflag = true;
			for(int i = 0; i < n; i++) {
				if(flag[i] == false) {
					endflag = false;
				}
			}
			if(endflag == true) {
				break;
			}

			for(int i = 0; i < n; i++) {
				if(flag[i] == false && len[point][i] > 0 && (Length[i] < 0 || len[point][i] < Length[i])) {
					Length[i] = len[point][i];
				}
			}
		}

		cout << lantern << endl;
	}
	return 0;
}