#include <cstdio>
#include <queue>

static const size_t n_max = 100;

int main() {
  for (;;) {
    size_t n, m;
    std::vector<std::pair<int, size_t>> edges[n_max];
    bool visited[n_max] = {};
    scanf("%zu", &n);
    if (!n)
      break;
    scanf("%zu", &m);
    for (size_t i = 0; i < m; i++) {
      size_t a, b;
      int d;
      scanf("%zu,%zu,%d", &a, &b, &d);
      d = -(d / 100 - 1);
      edges[a].push_back(std::make_pair(d, b));
      edges[b].push_back(std::make_pair(d, a));
    }
    std::priority_queue<std::pair<int, size_t>> pq;
    visited[0] = true;
    for (auto&& p : edges[0])
      pq.push(p);
    int c = 0;
    for (size_t i = 1; i < n;) {
      auto p = pq.top();
      pq.pop();
      auto d = p.first;
      auto a = p.second;
      if (visited[a])
        continue;
      visited[a] = true;
      i++;
      c += d;
      for (auto&& p : edges[a])
        pq.push(p);
    }
    printf("%d\n", -c);
  }
}