#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define INF 10000000
#define MAX_V 100
using namespace std;
int n,m;
int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int prim(){
  int res = 0;
  fill(mincost,mincost + n,INF);
  fill(used,used + n,false);

  mincost[0] = 0;
  while(1){

    int v = -1;

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

int main(){

  char ch;
  while(cin >> n,n){
    cin >> m;
    for(int i = 0 ; i < n ; i++ ){
      for(int j = 0 ; j < n ; j++ ){
	cost[i][j] = INF;
      }
    }
    for(int i = 0 ; i < m ; i++ ){
      int a,b,c;
      cin >> a >> ch >> b >> ch >> c;
      cost[a][b] = cost[b][a] = (c-100)/100;
    }
    cout <<  prim() << endl;
  }
  return 0;
}