#include <iostream>
#include <string>
#include <stdlib.h>
#define INF 0x7fffffff
#define MAX_V 100
using namespace std;

int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int V; // V<=100

int prim(){
  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++ )
      mincost[u] = min( mincost[u], cost[v][u] );
  }
  return res;
}

int main(){
  int m;
  string line;
  char buf[256];

  while(  cin >> V,V ){
    cin >> m;
    //    cout << "V="<<V <<" m="<<m<<endl;

    int x,y;
    int k;
    for( int i=0;i<V;i++ )
      for( int j=0;j<V;j++ )
	cost[i][j] = INF;
    for( int i=0,j;i<m;i++ ){
      cin >> line;
      for( j=0;j<line.size();j++ ) buf[j] = line.at(j);
      buf[j] = '\0';
      x = atoi( buf );
      for( j=0; buf[j]!=',';j++ );
      y = atoi( ++j+buf );
      for( ; buf[j]!=',';j++ );
      k = atoi( ++j+buf );
      //       cout << x <<"_"<<y<<"_"<<k<< endl;
      k = k/100 -1; // ÂÂÂUÂÃÂÂ
      cost[x][y] = k;
      cost[y][x] = k;
    }
    cout << prim() << endl;
  }

  return 0;
}