#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#define INF 100000000
using namespace std;
typedef pair<int,int> P;
struct edge {
  int to,cost;
};

int n,m;
vector<edge> G[100];
int mincost[100];
bool used[100];

int prim() {
  for(int i=0;i<n;i++) {
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  int res = 0;
  while(true) {
    int v = -1;
    for(int i=0;i<n;i++) {
      if(!used[i] && (v == -1 || mincost[i] < mincost[v] ) ) v = i;
    }

    if(v == -1) break;
    res += mincost[v];
    used[v] = true;

    for(int i=0;i<G[v].size();i++) {
      edge e = G[v][i];
      if(mincost[e.to] > e.cost) {
	mincost[e.to] = e.cost;
      }
    }
  }
  return (res/100) - n + 1;
}

int main() {
  while(cin >> n) {
    if(n==0) break;
    cin >> m;
    for(int i=0;i<m;i++) {
      int f,t,c;
      scanf("%d,%d,%d",&f,&t,&c);
      //      cout << f << " " << t << " " << c << endl;
      edge temp;
      temp.to = t;
      temp.cost = c;
      G[f].push_back(temp);
      temp.to = f;
      G[t].push_back(temp);
    }
    cout << prim() << endl;
    for(int i=0;i<n;i++) {
      G[i].clear();
    }
  }
}