#include <bits/stdc++.h>
using namespace std;

struct edge{
  int to,cost;
  edge(int t, int c){
    to = t; cost = c;
  }
};

typedef vector<vector<edge> > AdjList;

#define INF 1e+9

int MinSpanningTree(AdjList g){

  int n = g.size();
  int res = 0;

  vector<int> d(n,INF);
  d[0] = 0;
  vector<int> use(n,0);

  while(1){
    int v = -1;
    for(int u=0;u<n;u++){
      if( !use[u] and (v<0 or d[v] > d[u]))
	v = u;
    }
    if(v<0) break;
    use[v] = 1;
    res += d[v];
    for(int i=0; i<g[v].size();i++)
      d[ g[v][i].to ] = min( d[ g[v][i].to ], g[v][i].cost);
  }
  return res;
}

int main(){

  while(1){
    int n,m; cin >> n;
    if(!n) break;
    cin >> m;

    AdjList g(n);
    for(int i=0; i<m; i++){
      int from,to,c;
      //cin >> from >> to >> c;
      scanf("%d,%d,%d",&from,&to,&c);
      g[from].push_back(edge(to,c/100 - 1));
      g[to].push_back(edge(from,c/100 - 1));
    }
    int ans = MinSpanningTree(g);
    cout << ans << endl;
  }
  

}