#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int data[252];
void init(){
  REP(i,252)data[i]=-1;
}
int root(int a){
  return data[a]<0?a:data[a]=root(data[a]);
}
void unite(int a,int b){
  a=root(a);b=root(b);
  if(a!=b){
    if(data[a]<data[b])swap(a,b);
    data[a]+=data[b]; data[b]=a;
  }
}
bool same(int a,int b){
  return root(a)==root(b);
}

int main(){
  while(true){
    int n,m;
    cin>>n; if(!n)break;
    cin>>m;
    pair<int,pii> es[m];
    REP(i,m){
      int a,b,c;
      scanf("%d,%d,%d",&a,&b,&c);
      es[i].first = c;
      es[i].second.first = a;
      es[i].second.second = b;
    }
    sort(es,es+m);
    init();
    int res = 0;
    REP(i,m){
      int a,b,c;
      a=es[i].second.first;
      b=es[i].second.second;
      c=es[i].first;
      if(!same(a,b)){
        unite(a,b);
        res += (c-100)/100;
      }
    }
    cout<<res<<endl;
  }
  return 0;
}