#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair <int, int> PII;
typedef pair <int, PII> PIP;

const int size = 101;
int P[size];
bool used[size];
int cnt[size];
int n, m;
vector <PIP> E;

void init( int n ) {
  for ( int i = 0; i < n; i++ ) {
    P[i] = -1;
  }
}

int find( int a ) {
  if ( P[a] == -1 ) return a;
  return P[a] = find( P[a] );
}

void unite( int a, int b ) {
  int fa = find( a ), fb = find( b );
  if ( fa != fb ) {
    P[fa] = fb;
  }
}

bool same_set( int a, int b ) {
  return find( a ) == find( b );
}

int main() {
  string line;

  while ( getline( cin, line ) ) {
    if ( line == "0" ) break;

    {
      // n
      istringstream is( line );
      is >> n;
    }
    {
      // m
      getline( cin, line );
      istringstream is( line );
      is >> m;
    }
    for ( int i = 0; i < m; i++ ) {
      // a, b, c
      getline( cin, line );
      replace( line.begin(), line.end(), ',', ' ' );
      istringstream is( line );
      int a, b, c;
      is >> a >> b >> c;

      // add edge
      PIP edge( c, PII( a, b ) );
      E.push_back( edge );
    }

    sort( E.begin(), E.end() );

    init(n);
    for ( int i = 0; i < n; i++ ) {
      used[i] = false;
      cnt[i] = 0;
    }

    for ( int i = 0; i < m; i++ ) {
      int b = E[i].second.first;
      int c = E[i].second.second;

      if ( find( b ) != find( c ) ) {
	unite( b, c );
	used[i] = true;
      }
    }

    int answer = 0;
    for ( int i = 0; i < m; i++ ) {
      if ( used[i] ) {
	answer += ( E[i].first / 100 ) - 1;
      }
    }

    cout << answer << endl;
  }
  return 0;
}