#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define MAX 1000
#define INF 1<<30
using namespace std;
int V,E,cost[MAX][MAX],from,to,Cost;
bool used[MAX];
int mincost[MAX];

int prim(){
  int ans = 0;
  for(int i=0;i<V;i++){
    used[i] = false;
    mincost[i] = INF;
  }
  mincost[0] = 0;

  while(true){
    int v = -1;
    for(int i=0;i<V;i++){
      if(!used[i] && (v == -1 || mincost[i] < mincost[v]))v = i;
    }
    if(v == -1)break;
    used[v] = true;
    ans += mincost[v];

    for(int i=0;i<V;i++){
      mincost[i] = min(mincost[i],cost[v][i]);
    }
  }


  return ans;

}

int main(){
  
  
  while(cin >> V && V){
    for(int i=0;i<MAX;i++)for(int j=0;j<MAX;j++)cost[i][j] = INF;
    cin >> E;
    for(int i=0;i<E;i++){
      scanf("%d,%d,%d\n",&from,&to,&Cost);
      cost[from][to] = cost[to][from] =  Cost;
    }
    
    cout <<  prim()/100 - (V-1) << endl;

  }
  return 0;
}