#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;
}

int Prim(Graph& g,Edges& tree,int root=0)
{
	tree.clear();
	
	int size=g.size();
	vector<int> visited(size);
	
	priority_queue<Edge,vector<Edge>,greater<Edge> > pq;
	pq.push(Edge(-1,root,0));
	int res=0;
	while(!pq.empty()){
		Edge e=pq.top();
		pq.pop();
		if(visited[e.dst])
			continue;
		if(e.src!=-1)
			tree.push_back(e);
		visited[e.dst]=1;
		res+=e.weight;
		rep(i,g[e.dst].size()){
			Edge cand=g[e.dst][i];
			if(!visited[cand.dst])
				pq.push(cand);
		}
	}
	return res;
}

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(dst,src,weight/100-1));
		}
		Edges e;
		int sum=Kruskal(g,e);
		//int sum=Prim(g,e);
		cout<<sum<<endl;
	}
	
	return 0;
}