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