#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

typedef pair<int, int> Pair;

struct Edge {
  int len;
  int to;
};

int n;
int m;
bool used[10000];
vector<Edge> es[10000];
priority_queue<Pair, vector<Pair>, greater<Pair> > q;

int CalcMSTCost() {
  int ret = 0;

  fill(used, used+n, false);
  q.push(Pair(0, 0));
  while (!q.empty()) {
    Pair p = q.top(); q.pop();
    int d = p.first;
    int v = p.second;

    if (used[v]) continue;
    used[v] = true;
    ret += d;
    for (int i=0; i<es[v].size(); i++) {
      q.push(Pair(es[v][i].len, es[v][i].to));
    }
  }

  return ret;
}

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    for (int i=0; i<n; i++) {
      es[i].clear();
    }
  
    scanf("%d", &m);
    for (int i=0; i<m; i++) {
      int a, b;
      struct Edge e;
      scanf("%d,%d,%d", &a, &b, &e.len);
      e.len -= 100;
      e.to = b;
      es[a].push_back(e);
      e.to = a;
      es[b].push_back(e);
    }

    printf("%d\n", CalcMSTCost()/100);
  }
}