#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#define MAX 100000
#define INF 1<<30
using namespace std;
int V,E;

struct Pox
{
  int from,to,cost;
  Pox(int from = -1,int to = -1,int cost = -1):from(from),to(to),cost(cost){}
};

bool cmp(const Pox& p1,const Pox& p2)
{
  return p1.cost < p2.cost;
}



int par[MAX+1];

int find(int x)
{
  if(x == par[x])return x;
  return par[x] = find(par[x]);
}

void unit(int x,int y)
{
  x = find(x);
  y = find(y);
  if(x != y)
    par[x] = y;
}

bool same(int x,int y)
{
  return find(x) == find(y);
}

int kruskal(vector<Pox>& G)
{
  sort(G.begin(),G.end(),cmp);
  int res = 0;
  for(int i=0;i<G.size();i++)
    {
      Pox pox = G[i];
      if(!same(pox.from,pox.to))
	{
	  unit(pox.from,pox.to);
	  res += pox.cost;
	}
    }
  return res;
}
 
int main(){
   
   
  while(cin >> V && V){  
    cin >> E;
    vector<Pox> G;
    for(int i=0;i<E;i++){
      par[i] = i;
      int from,to,Cost;
      scanf("%d,%d,%d",&from,&to,&Cost);
      G.push_back(Pox(from,to,Cost));
    }
  
    cout <<  kruskal(G)/100 - (V-1) << endl;
 
  }
  return 0;
}