#include<iostream>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
#define fr first
#define sc second
#define MAX 101
#define INFTY 1000000000
int cost[MAX][MAX];
int min_cost[MAX];
bool used[MAX];
int n,m;
int prim(){
  int res = 0;
  for(int i=0;i<n;i++){
    min_cost[i] = INFTY;
    used[i] = false;
  }
  min_cost[0] = 0;
  while( true ){
    int v = -1;
    for(int u=0 ; u < n ; u++ ){
      if( !used[u] && (v == -1 || min_cost[u] < min_cost[v]) ){
        v = u;
      }
    }
    if(v == -1) break;
    used[v] = true;
    res += min_cost[v];
    for(int u=0 ; u < n ; u++ ){
      min_cost[u] = min( min_cost[u] , cost[v][u] );
    }
  }
  return res;
}
int main(){
  while(cin >> n && n){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        cost[i][j] = INFTY;
      }
    }
    cin >> m;
    for(int i=0,a,b,c;i<m;i++){
      scanf("%d,%d,%d",&a,&b,&c);
      cost[a][b] = cost[b][a] = (c-100)/100;
    }
    cout  << prim() << endl;
  }
}