#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;

class street{
public:
  int a,b,d;
  void set(int x,int y,int z){a = x;b = y;d = z;};
  bool operator<(const street x)const{return d>x.d;}
};

int uf[100],rank[100];

int par(int x){
  if(uf[x] == x)return x;
  return uf[x] = par(uf[x]);
}

void unit(int x,int y){
  x = par(x);
  y = par(y);
  if(x==y)return;
  if(rank[x] < rank[y]){
    uf[x] = y;
  }else{
    uf[y] = x;
    if(rank[x]==rank[y])rank[x]++;
  }
}

int main(){
  int n,m;

  while(scanf("%d",&n) && n){
    scanf("%d",&m);
    priority_queue<street> q;

    for(int i=0;i<m;i++){
      int x,y,z;
      scanf("%d%*c%d%*c%d ",&x,&y,&z);
      q.push((street){x,y,z/100-1});
    }
    
    for(int i=0;i<n;i++){
      uf[i] = i;
      rank[i] = 0;
    }
    int ans = 0;

    while(q.size()){
      street s = q.top();q.pop();
      if(par(s.a) != par(s.b)){
	ans += s.d;
	unit(s.a,s.b);
      }
    }
    printf("%d\n",ans);
  }
}