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

const int INF= 1e9;

struct edge{
  int from, to, cost;
  edge(int x,int y, int z):from(x),to(y),cost(z){}
  bool operator<(const edge &x)const{ return cost<x.cost; }
};

typedef pair<int,int> pii;

class Prim{
  int n;
  vector< vector<edge> > g;
public:
  Prim(int a=0):n(a){ g.resize(n); }

  void AddEdge(int a, int b, int cost){
    g[a].push_back(edge(a,b,cost));
    g[b].push_back(edge(b,a,cost));
  }

  int MinSpanningTree(){
    int res = 0;
    vector<int> d(n,INF); d[0] = 0;
    priority_queue<pii, vector<pii>, greater<pii> > q;
    q.push(pii(0,0));

    while(q.size()){
      int cost = q.top().first, v = q.top().second; q.pop();
      if(d[v] < cost)continue;
      res += cost; d[v] = -INF;

      for(int i=0;i<(int)g[v].size();i++){
	int to = g[v][i].to, nxtcost = g[v][i].cost;
	if(d[to] > nxtcost){
	  d[to] = nxtcost;
	  q.push( pii(nxtcost,to) );
	}
      }
    }
    return res;
  }
};

int main(){
  int n,m;
  while(scanf("%d",&n),n){
    Prim p(n);
    cin >> m;
    for(int i=0;i<m;i++){
      int a,b,c;
      scanf("%d,%d,%d",&a,&b,&c);
      p.AddEdge(a,b,c/100-1);
    }
    cout << p.MinSpanningTree() << endl;
  }
}