#include<iostream>
#include<cstdio>
using namespace std;

const int MAX_V = 100;
const int INF = 100000;

int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];

int prim(int V) {
  for (int i = 0; i < V; i++) {
    mincost[i] = INF;
    used[i] = false;
  }

  mincost[0] = 0;
  int res = 0;

  while(true) {
    int v = -1;
    for (int u = 0; u < V; u++) {
      if (! used[u] and (v == -1 or mincost[u] < mincost[v]))
        v = u;
    }

    if (v == -1)
      break;

    used[v] = true;

    res += mincost[v];

    for (int u = 0; u < V; u++)
      mincost[u] = min(mincost[u], cost[v][u]);
  }

  return res;
}

int main() {
  int n;
  while (cin >> n and n != 0) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        cost[i][j] = INF;

    int m, a, b, dist;
    cin >> m;

    for(int i = 0; i < m; i++) {
      scanf("%d,%d,%d", &a, &b, &dist);
      dist = dist / 100 - 1;
      cost[a][b] = cost[b][a] = dist;
    }

    int val = prim(n);

    cout << val << endl;
  }
}