#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef pair<int, int> pii;
typedef vector<pii> vp;

int main() {
	while (true) {
		int n, m;
		cin >> n;
		if (n == 0) break;
		cin >> m;
		
		vector<vp> g(n);
		REP(i, m) {
			int a, b, c;
			scanf("%d,%d,%d", &a, &b, &c);
			g[a].push_back(pii(c / 100, b));
		}
	
		priority_queue<pii, vector<pii>, greater<pii> > qu;
		vector<bool> used(n);
		int ans = 0;
		
		qu.push(pii(0, 0));
		while (! qu.empty()) {
			int cost = qu.top().first;
			int pos = qu.top().second;
			qu.pop();
			
			if (used[pos]) continue;
			used[pos] = true;
			
			ans += cost;
			
			REP(i, g[pos].size()) {
				qu.push(pii(g[pos][i].first, g[pos][i].second));
			}
		}
		
		cout << ans - (n-1) << endl;
	}
	
	return 0;
}