#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
#include<queue>
#include <functional>
#define MAX_V 1001
#define INF 100000
using namespace std;

int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int n,m;

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 u=0;u<n;u++){
      if(!used[u] && (v==-1 || mincost[u]<mincost[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    res+=mincost[v];
    for(int u=0;u<n;u++){
      mincost[u]=min(mincost[u],cost[v][u]);
    }
  }
  return res;
}

int main(){
  int a,b,c,ans;
  while(1){
    cin >> n;
    if(n == 0)break;
    cin >> m;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	cost[i][j]=INF;
      }
    }
    for(int i=0;i<m;i++){
      scanf("%d,%d,%d",&a,&b,&c);
      cost[a][b]=c/100-1;
      cost[b][a]=c/100-1;
    }
    ans = prim();
    cout << ans << endl;
  }
}