#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int h,i,j;
  int a[100][100],b[100],p[5000],q[5000],r[5000],m,n,o;
  int sm;
  while(cin>>n&&n){
    cin>>m;
    memset(a,0,sizeof(a));
    for(i=0;i<m;i++){
      scanf("%d,%d,%d",&p[i],&q[i],&r[i]);
      r[i]=r[i]/100-1;
      a[p[i]][q[i]]=r[i];
      a[q[i]][p[i]]=r[i];
    }
    do{
      h=0;
      for(i=1;i<m;i++){
	if(r[i-1]>r[i]){
	  swap(p[i-1],p[i]);
	  swap(q[i-1],q[i]);
	  swap(r[i-1],r[i]);
	  h=1;
	}
      }
    }while(h);
    memset(b,0,sizeof(b));
    h=-1;
    o=0;
    sm=0;
    for(i=1;i<n;i++){
      for(h++;r[h]==0;h++);
      sm+=r[h];
      if(b[p[h]]==0&&b[q[h]]==0){
	o++;
	b[p[h]]=o;
	b[q[h]]=o;
      }else if(b[p[h]]==0)
	b[p[h]]=b[q[h]];
      else if(b[q[h]]==0)
	b[q[h]]=b[p[h]];
      else{
	for(j=0;j<n;j++){
	  if(p[h]!=j&&b[p[h]]==b[j])
	    b[j]=b[q[h]];
	}
	b[p[h]]=b[q[h]];
      }
      for(j=0;j<n;j++){
	if(b[p[h]]==b[j]&&a[p[h]][j]){
	  a[p[h]][j]=0;
	  a[j][p[h]]=0;
	}
	if(b[q[h]]==b[j]&&a[q[h]][j]){
	  a[q[h]][j]=0;
	  a[j][q[h]]=0;
	}
      }
      for(j=h+1;j<m;j++){
	if(r[j]&&a[p[j]][q[j]]==0)
	  r[j]=0;
      }
    }
    cout<<sm<<endl;
  }
  return 0;
}