#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 10000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

class UnionFind {
  vector<int> parent;
public:
  UnionFind(int n) : parent(n) {
    rep(i, n) parent[i] = i;
  }

  int root(int x) {
    if(x == parent[x]) return x;
    return parent[x] = root(parent[x]);
  }

  void unite(int x, int y) {
    if(root(x) == root(y)) return;
    if(root(x) < root(y)) {
      parent[y] = root(x);
    }else {
      parent[x] = root(y);
    }
  }

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

int main() {
  int n, m;
  while(cin >> n && n) {
    cin >> m;
    UnionFind uf(n);
    vector<IP> v;
    rep(i, m) {
      int a, b, c; char d;
      cin >> a;
      while(cin >> d && d!=',');
      cin >> b;
      while(cin >> d && d!=',');
      cin >> c;
      v.push_back(IP(c/100, P(a, b)));
    }
    sort(ALL(v));
    int ans = 0;
    rep(i, m) {
      IP &e = v[i];
      int c = e.first, a = e.second.first, b = e.second.second;
      if(!uf.is_same(a, b)) {
        uf.unite(a, b);
        ans += c - 1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}