#include <iostream>
#include <algorithm>
#include <cstdlib>

using namespace std;
#define MAX_N 100
int par[MAX_N];
int myrank[MAX_N];
int n,m;


struct edge {
    int a, b, d;

    /*
    bool operator <(const edge& r) {
      return this->d < r.d;
    }
     */
};

// Union Find Tree?????????????????????
//????????¶?????§??????????????????????????§???
//?????¨??????????´???????????????????
void init(int n) {
  for (int i = 0; i < n; i++) {
    par[i] = i;
    myrank[i] = 0;
  }
}

// x?????????????´?????±??????????????????£??¨????????????
int find(int x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

// x,y????±?????????????????????¨??????
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) {
    return;
  }
  if (myrank[x] < myrank[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (myrank[x] == myrank[y]) myrank[x]++;
  }
}

// x,y????±?????????????????????????????????????
int same(int x, int y) {
  return find(x) == find(y);
}

void Tree_print() {
  int i;
  for (i = 0; i < n; i++) cout << par[i];
  cout << endl;

}

int compare_edge(const void *a,const void * b){
  edge temp1 = *(edge *)a;
  edge temp2 = *(edge *)b;

  return temp1.d-temp2.d;
}
int main() {
  int count ,t ;
  while (1){
    cin >> n ;
    if(n == 0) break;
    cin >> m;
    init(n);

    edge e[n];


    t =0;
    count =0;
    for(int i = 0; i < m; i ++){
      scanf("%d,%d,%d", &(e[i].a), &(e[i].b), &(e[i].d));
    }

    qsort(e,n, sizeof(*e),compare_edge);
    while(count != m-1) {
      for (int i = 0; i < n; ++i) {
        if(same(e[i].a,e[i].b) != 1) {
          count++;
          t = t + (int) e[i].d /100 - 1;
          unite(e[i].a,e[i].b);
        }
      }
      cout << t<<endl;
    }

  }




  return 0;
}