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

using namespace std;

constexpr int MAX_N = 100;
constexpr int MAX_M = MAX_N * MAX_N;
int par[MAX_N];
int myrank[MAX_N];
int n, m;


struct edge {
    int a, b, d;

    bool operator<(const edge &r) {
      return d < r.d;
    }
};

array<edge, MAX_M> e;


// Union Find Tree?????????????????????
//????????¶?????§??????????????????????????§???
//?????¨??????????´???????????????????
void init() {
  for (int i = 0; i < MAX_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????±?????????????????????¨??????
bool unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y)
    return false;

  if (myrank[x] < myrank[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (myrank[x] == myrank[y]) myrank[x]++;
  }

  return true;
}

int main() {
  int count, t;

  while (cin >> n, n) {
    cin >> m;
    init();

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

    sort(e.begin(), e.begin() + n);
    for (int i = 0; i < n; ++i) {
      if (unite(e[i].a, e[i].b))
        t += e[i].d / 100 - 1;
    }
    cout << t << endl;
  }

  return 0;
}