#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>

//AOJ0072
#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;
struct ttk{
	int tf,tt,km;
//	ttk(int tf, int tt, int km): tf(tf), tt(tt), km(km) {}
	bool operator<(const  ttk  &s) const {
    return km < s.km;
  }

};

int main(void){

int n,m;
char k;
	while(cin >> n){
		if(n==0 || cin.eof()) break;
		vector<int> mt(n,0);
		int cnt=0,cnt2=0;
		cin >> m;
		vector< ttk > tw(m);
		rep(i,m)
			cin >> tw[i].tf >> k >> tw[i].tt >> k >> tw[i].km;
		sort(tw.begin(), tw.end());
//		rep(i,m) printf("%d-%d :%d\n",tw[i].tf, tw[i].tt, tw[i].km );
		mt[tw[0].tf]=1; 	mt[tw[0].tt]=1;
		cnt += 1;    cnt2 += tw[0].km;
		
		while(1){
			bool brsw=true;
			rep(i,m){
				if(mt[tw[i].tf] + mt[tw[i].tt] == 1){
					mt[tw[i].tf]=1; 	mt[tw[i].tt]=1;
					cnt += 1;    cnt2 += tw[i].km;
					break;
				}
			}
			rep(i,n) if(mt[i]==0) brsw = false;
			if(brsw) break;
			
			
		}

//		printf(" %d: %d \n",cnt,cnt2);
		cout << cnt2/100 - cnt << endl;
	}
	return 0;
	
}