#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

#define MIN(A, B) (A) < (B) ? (A) : (B)


int main() {
	bool st[10000];
	int a[10000], b[10000], d[10000];
	int n, m;	
	while (cin >> n, n) {
		memset(st, 0, sizeof st);
		cin >> m;
		for (int i = 0; i < m; i++) {
			int dis;
			scanf("%d,%d,%d", &a[i], &b[i], &dis);
			d[i] = dis/100;
		}
		

		for (int i = 0; i < n; i++) {
			int min = -1;
			for (int j = 0; j < m; j++) {
				if (a[j] == i || b[j] == i) {
					if (min == -1)
						min = j;
					else
						min = d[min] < d[j] ? min : j;
				}
			}
			st[min] = true;
		}

		int md = 0;
		for (int i = 0; i < m; i++) {
			if (st[i])
				md += d[i];
		}

		cout << md - (n-1) << endl;
	}
	return 0;
}