#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
 
using namespace std;
 
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#ifdef __BORLANDC__
	typedef __int64 ll;
#else
	typedef long long ll;
#endif




class Prim{
	public:
	static const int PN = 1000;
	typedef pair<int,int> pii;
	
	
	vector<pii> edge[PN];
	Prim(){
		rep(i,PN)edge[i].clear();
	}
	
	void add_edge(int a,int b, int c){
		edge[a].push_back(pii(b,c));
	}
	
	class Q{
		public:
		int pos;
		int val;
		Q(int pos,int val):pos(pos),val(val){};
		bool operator<(const Q& a)const{
			if(val!=a.val)return val>a.val;
			return pos>a.pos;
		}
	};
	
	int visit[PN];
	int solve(int st){
		rep(i,PN)visit[i]=0;
		priority_queue<Q> que;
		que.push(Q(st,0));
		
		int ret = 0;
		while(!que.empty()){
			Q u = que.top();
			que.pop();
			
			if(visit[u.pos]==1)continue;
			visit[u.pos]=1;
			
			ret += u.val;
			
			rep(i,edge[u.pos].size()){
				pii e = edge[u.pos][i];
				que.push(Q(e.first, e.second));
			}
		}
		return ret;
	}
	
};

int main(){
	int n,m;
	while(cin>>n,n){
		cin>>m;
		
		Prim prim;
		rep(i,m){
			int a,b,c;
			scanf("%d,%d,%d",&a,&b,&c);
			int d = (c+99)/100-1;
			prim.add_edge(a,b,d);
			prim.add_edge(b,a,d);
			
		}
		
		cout<<prim.solve(0)<<endl;
		
	}
}