#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef int Weight;
struct Edge {
  int src, dest;
  Weight weight;
  Edge(int src, int dest, Weight weight): src(src), dest(dest), weight(weight) {;}
  bool operator<(const Edge &rhs) const {
    return weight < rhs.weight;
  }
};

struct UnionFind {
  int parent[100];
  UnionFind() {
    memset(parent, -1, sizeof(parent));
  }

  bool unite(int x, int y) 
  {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (parent[y] < parent[x]) { swap(x, y); }
    parent[x] += parent[y];
    parent[y] = x;
    return true;
  }

  bool find(int x, int y) 
  {
    return root(x) == root(y);
  }

  int root(int x) 
  {
    return parent[x] < 0 ? x : parent[x] = root(parent[x]);
  }
};

int M, N;
vector<Edge> es;
void Solve() 
{
  sort(es.begin(), es.end());
  UnionFind uf;
  int res = 0;
  for (int i = 0; i < M; i++) {
    Edge e = es[i];
    if (!uf.find(e.src, e.dest)) {
      uf.unite(e.src, e.dest);
      res += (int)(e.weight / 100) - 1;
    }
  
  }
  cout << res << endl;
}

int main() 
{
  int u, v, w;
  while (cin >> N && N) {
    cin >> M;
    es.clear();
    for (int i = 0; i < M; i++) {
      scanf("%d,%d,%d", &u, &v, &w);
      es.push_back(Edge(u, v, w));
    }

    Solve();
  }
}