#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

struct Edge{
	int src,dst,weight;
	Edge(){}
	Edge(int s,int d,int w):src(s),dst(d),weight(w){}
};

bool operator<(const Edge& lhs,const Edge& rhs)
{
	return lhs.weight<rhs.weight;
}

bool operator>(const Edge& lhs,const Edge& rhs)
{
	return lhs.weight>rhs.weight;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

struct UnionFind{
	vi data;
	UnionFind(int size):data(size,-1){}
	int Find(int n){
		return data[n]<0?n:(data[n]=Find(data[n]));
	}
	void Union(int n1,int n2){
		int d1=Find(n1);
		int d2=Find(n2);
		if(d1!=d2){
			if(-data[d1]<-data[d2])
				swap(d1,d2);
			data[d1]+=data[d2];
			data[d2]=d1;
		}
	}
	int Size(int n){
		return -data[Find(n)];
	}
};

int Kruskal(Graph& g,Edges& e)
{
	e.clear();
	
	UnionFind uf(g.size());
	multiset<Edge> s;
	rep(i,g.size())
		rep(j,g[i].size())
			s.insert(g[i][j]);
	
	int res=0;
	foreach(i,s){
		if(uf.Find(i->src)!=uf.Find(i->dst)){
			uf.Union(i->src,i->dst);
			res+=i->weight;
			e.push_back(*i);
		}
	}
	
	return res;
}

//ostream& operator<<(ostream& os,const vi& a)
//{
//	rep(i,a.size())
//		printf("%d%s",a[i],i==a.size()-1?"":" ");
//	return os;
//}
//
////pair<Weight, Edges> minimumSpanningForest(const Graph &g) {
//pair<int, Edges> minimumSpanningForest(const Graph &g) {
//  int n = g.size();
//  UnionFind uf(n);
//  //priority_queue<Edge> Q;
//  priority_queue<Edge,vector<Edge>,greater<Edge> > Q;
//  //rep(u, n) foreach(e, g[u]) if (u < e->dst) Q.push(*e);
//  rep(u, n) foreach(e, g[u]) Q.push(*e);
//  multiset<Edge> s;
//  rep(i,g.size())rep(j,g[i].size())s.insert(g[i][j]);
//  //puts("#s:");
//  //foreach(i,s)
//  //  printf("%d %d %d\n",i->src,i->dst,i->weight);
//
//  //Weight total = 0;
//  int total = 0;
//  Edges F;
//  //while (F.size() < n-1 && !Q.empty()) {
//  //  Edge e = Q.top(); Q.pop();
//  foreach(i,s){
//    if(F.size()>=n)
//    	break;
//    Edge e=*i;
//    //if (uf.unionSet(e.src, e.dst)) {
//    //  F.push_back(e);
//    //  total += e.weight;
//    //}
//	if(uf.Find(e.src)!=uf.Find(e.dst)){
//		uf.Union(e.src,e.dst);
//		F.push_back(e);
//		total+=e.weight;
//	}
//  }
//  //puts("#F:");
//  //rep(i,F.size())
//  //  printf("%d %d %d\n",F[i].src,F[i].dst,F[i].weight);  
//  //return pair<Weight, Edges>(total, F);
//  return pair<int, Edges>(total, F);
//}

int main()
{
	for(int n,m;cin>>n>>m,n;){
		Graph g(n);
		rep(i,m){
			int src,dst,weight;
			scanf("%d,%d,%d",&src,&dst,&weight);
			g[src].push_back(Edge(src,dst,weight/100-1));
			g[dst].push_back(Edge(src,dst,weight/100-1));
		}
		Edges e;
		int sum=Kruskal(g,e);
		//cout<<sum/100-e.size()<<endl;
		cout<<sum<<endl;
		
		//cout<<minimumSpanningForest(g).first<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0