#include<cstdio>
#include<iostream>
using namespace std;

#define MAX_V 111
#define INF 2147483647

int cost[MAX_V][MAX_V]={{}};
int mincost[MAX_V]={};
bool used[MAX_V]={};
int V;


int prim(void);
int min(int a,int b);

int main(){
  int m;

  scanf("%d",&V);

  while(1){
    if(V==0) break;
    scanf("%d",&m);
    
    /*
    for(int i=0;i<m;i++){
      for(int j=0;j<m;j++){
	cost[i][j]=INF;
      }
      }*/
    
    for(int i=0;i<m;i++){
      int a,b,c;
      scanf("%d,%d,%d",&a,&b,&c);
      cost[a][b] = c/100 - 1;
      cost[b][a] = c/100 - 1;
    }
    
    printf("%d\n",prim());
    
    scanf("%d",&V);
  }
  
  return 0;
}

int min(int a,int b){
  if(a>b) return b;
  return a;
}

int prim(void){
  for(int i=0;i<V;i++){
    mincost[i] = INF;
    used[i] = false;
  }
  
  mincost[0] = 0;

  int res = 0;
  
  while(true){
    int v = -1;
    for(int u=0;u<V;u++){
      if(!used[u] && (v==-1 || mincost[u] <  mincost[v])) v = u;
    }
    
    if(v == -1) break;
    used[v] = true;
    res += mincost[v];
    
    for(int u = 0;u < V;u++){
      if(cost[v][u]==0);
      else mincost[u] = min(mincost[u], cost[v][u]);
    }
  }
  return res;
}