#include<iostream>
#include<vector>
#include<algorithm>
#define M 10000000

using namespace std;

int Prim(const vector< vector<int> >& data){
  vector<bool> is_reached(data.size(), false);
  vector<int> cost(data.size(), M);
  int i, j, ans;

  i = 0;
  ans = 0;
  cost[i] = 0;

  while(i >= 0){
    ans += cost[i];
    is_reached[i] = true;

    for(j=0; j<data[i].size(); ++j){
      cost[j] = min(cost[j], data[i][j]);
    }
    for(i=-1, j=0; j<is_reached.size(); ++j){
      if(!is_reached[j] && (i < 0 || cost[i] > cost[j])) i = j;
    }
  }
  return ans;
}

int main(){
  int n, m;
  int a, b, c;
  char dm;

  while(1){
    cin >> n;
    if(n == 0) break;
    vector< vector<int> > data(n, vector<int>(n, M));

    cin >> m;
    for(int i=0; i<m; ++i){
      cin >> a >> dm >> b >> dm >> c;
      c = c/100 - 1;
      data[a][b] = c;
      data[b][a] = c;
    }

    cout << Prim(data) << endl;
  }
  return 0;
}