#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

#define MAX_N 200000

class UnionFind {
private:
  // ?????¨??¨?????±???
  int par[MAX_N];
  int rank[MAX_N];
  int s[MAX_N];
public:
  void init(int n);
  int find(int x);
  void unite(int x, int y);
  bool same(int x, int y);
};

// ????´???°n??§?????????
void UnionFind::init (int n) {
  for(int i=0; i<n; i++) {
    par[i] = i;
    rank[i] = 0;
    s[i] = 1;
  }
}

// ????´?x??????????±???????
int UnionFind::find(int x) {
  if(par[x] == x) return x;
  else return par[x] = find(par[x]);
}

// x??¨y????±??????????????????????
void UnionFind::unite(int x, int y) {
  // x??¨y??????
  x = find(x);
  y = find(y);
  if(x == y) return;

  // y??????????????±????????±??????x?????????y??????
  if(rank[x] < rank[y]) {
    par[x] = y;
    s[y] = s[x] + s[y];
  }
  else {
    par[y] = x;
    s[x] = s[x] + s[y];
    if( rank[x] == rank[y] ) rank[x]++;
  }
}

// x??¨y???????????????????±??????????
bool UnionFind::same(int x, int y) { return find(x) == find(y);}

struct edge{
  int u, v, cost;
};

bool comp(const edge& e1, const edge& e2) {
  return e1.cost < e2.cost;
}

edge es[10000];
int v, e;
UnionFind uf;

int kruskal() {
  sort(es, es+e, comp);
  uf.init(v);
  int res = 0;
  REP(i, e) {
    edge e = es[i];
    if(!uf.same(e.u, e.v)) {
      uf.unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}

signed main(void)
{
  while(true) {
    cin >> v;
    if(!v) break;
    cin >> e;
    REP(i, e) {
      int a, b, c;
      scanf("%d,%d,%d", &a, &b, &c);
      es[i] = {a, b, c/100-1};
    }
    cout << kruskal() << endl;
  }

  return 0;
}