#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());
//	set<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;
//}

//typedef int Weight;
//struct Edge {
//  int src, dst;
//  Weight weight;
//  Edge(int src, int dst, Weight weight) :
//    src(src), dst(dst), weight(weight) { }
//};
//bool operator < (const Edge &e, const Edge &f) {
//  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
//    e.src != f.src ? e.src < f.src : e.dst < f.dst;
//}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

//struct UnionFind {
//  vector<int> data;
//  UnionFind(int size) : data(size, -1) { }
//  bool unionSet(int x, int y) {
//    x = root(x); y = root(y);
//    if (x != y) {
//      if (data[y] < data[x]) swap(x, y);
//      data[x] += data[y]; data[y] = x;
//    }
//    return x != y;
//  }
//  bool findSet(int x, int y) {
//    return root(x) == root(y);
//  }
//  int root(int x) {
//    return data[x] < 0 ? x : data[x] = root(data[x]);
//  }
//  int size(int x) {
//    return -data[root(x)];
//  }
//};

//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);

  //Weight total = 0;
  int total = 0;
  Edges F;
  while (F.size() < n-1 && !Q.empty()) {
    Edge e = Q.top(); Q.pop();
    //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;
	}
  }
  //return pair<Weight, Edges>(total, F);
  return pair<int, Edges>(total, F);
}

ostream& operator<<(ostream& os,const vi& a)
{
	rep(i,a.size())
		printf("%d%s",a[i],i==a.size()-1?"":" ");
	return os;
}

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