#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define bitcount(x) __builtin_popcount(x)

class NODE{
public:	
	int a,b,c;
	NODE(int A,int B,int C){a = A , b = B , c = C;}
};
bool operator<(const NODE &a,const NODE &b){return a.c > b.c;}

int main(){
	int n;
	while(cin >> n , n){
		int m; cin >> m;
		vector<NODE> data[100];
		priority_queue<NODE> Q;
		rep(i,m){
			int a,b,c;
			scanf("%d,%d,%d",&a,&b,&c);
			data[a].push_back(NODE(a,b,c/100-1));
			data[b].push_back(NODE(b,a,c/100-1));
		}
		int ret = 0;
		bool done[100] = {0};
		Q.push(NODE(0,0,0));
		while(Q.size()){
			NODE q = Q.top(); Q.pop();
			if(done[q.b])continue;
			else ret += q.c , done[q.b] = true;
			rep(i,data[q.b].size()) Q.push(data[q.b][i]);
		}
		cout << ret << endl;
	}
}