#include<iostream>
#include<algorithm>
#define MAX_V 100
#define INF (1<<21)
using namespace std;

int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int V;
int prim(){
  for(int i = 0; i < V; i++){
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  int res = 0;
  while(1){
    int v = -1;
    for(int u = 0; u < V; 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 < V; u++){
      mincost[u] = min(mincost[u], cost[v][u]);
    }
  }
  return res;
}

int main(){
  int m;
  while(1){
    cin >> V;
    if(V == 0) break;
    for(int i = 0; i < V; i++){
      for(int j = 0; j < V; j++){
	cost[i][j] = INF;
      }
    }
    cin >> m;
    for(int i = 0; i < m; i++){
      int a, b, c;
      char d, e;
      cin >> a >> d >> b >> e >> c;
      cost[a][b] = c;
      cost[b][a] = c;
    }
    int t = prim();
    t = t / 100 - V + 1;
    cout << t << endl;
  }
}