#include<iostream>
#include<vector>
#include<cstdio>
#include<queue>
#include<algorithm>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define MAX_V 10100
#define MAX_E 101000
using namespace std;

struct P
{
  int to,cost;
  P(int to=inf,int cost=inf):to(to),cost(cost){}
  bool operator < (const P &a)const
  {
    return cost > a.cost;
  }
};

int V,E;
vector<P> G[MAX_V];
bool used[MAX_V];
int mincost[MAX_V];

int prim()
{
  rep(i,V)used[i] = false,mincost[i] = inf;
  mincost[0] = 0;

  priority_queue<P> Q;
  Q.push(P(0,0));

  int ans = 0;
  while(!Q.empty())
    {
      P p = Q.top(); Q.pop();
      int cur = p.to;

      if(used[cur])continue;
      used[cur] = true;

      ans += p.cost;

      for(int i=0;i<G[cur].size();i++)
	{
	  int next = G[cur][i].to;
	  if(used[next])continue;
	  if(mincost[next] > G[cur][i].cost)
	    {
	      mincost[next] = G[cur][i].cost;
	      Q.push(P(next,mincost[next]));
	    }
	}
    }
  return ans;
}

int main()
{
  while(cin >> V,V)
    {
      rep(i,V)G[i].clear();
      cin >> E;
      rep(i,E)
	{
	  int from,to,w;
	  //cin >> from >> to >> w;
	  scanf("%d,%d,%d",&from,&to,&w);
	  G[from].push_back(P(to,w));
	  G[to].push_back(P(from,w));
	}
      
      cout << prim()/100 - (V-1) << endl;
      
    }
  return 0;
}