#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <climits>
#include <vector>

using namespace std;

typedef vector< bool > BVI;
typedef vector< int > VI;
typedef vector< VI > VVI;

int main() {
	int n, m;	

	while( true ) {

		cin >> n;

		if( n == 0 ) {
			break;
		}

		cin >> m;

		VVI map(n, VI(n, INT_MAX / 4));
		VI mincost(n, INT_MAX / 4);
		BVI used(n, false);
		mincost[0] = 0;
		int res = 0;
		int a, b, c;
		char dummy;

		for(int i = 0; i < m; i++) {
			cin >> a >> dummy >> b >> dummy >> c;
			map[a][b] = (c / 100) - 1;
			map[b][a] = (c / 100) - 1;
		}

		while( true ) {
			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] = min(mincost[u], map[v][u]);
			}
		}


		cout << res << endl;
	}
}