//Carden Lantern
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)n; ++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

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 : e.src!=f.src ? e.src<f.src : e.dst<f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

pair<Weight, Edges> minimumSpanningTree(const Graph &g, int r=0){
  int n=g.size();
  Edges T;
  Weight total=0;

  vector<bool>visited(n);
  priority_queue<Edge> Q;
  Q.push(Edge(-1, r, 0));
  while(!Q.empty()){
    Edge e=Q.top(); Q.pop();
    if(visited[e.dst])continue;
    T.push_back(e);
    total+=e.weight;
    visited[e.dst]=true;
    FOR(f, g[e.dst]) if(!visited[f->dst])Q.push(*f);
  }
  return pair<Weight, Edges>(total, T);
}

int main(){
  int n, m;
  while(true){
    cin>>n;
    if(n==0)break;
    cin>>m;
    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));
    }
    cout<<minimumSpanningTree(g).first<<endl;
  }
  return 0;
}