#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<climits>

#define MAX_V 101
#define INF 10000000

using namespace std;


struct edge{int to, cost; };
typedef pair<int, int> P;

int V,mincost[MAX_V];
vector<edge>G[MAX_V];

int Prim(void){
  priority_queue<P, vector<P>, greater<P> >que;
  fill(mincost, mincost+V, INF);

  mincost[0]=0;
  que.push(P(0,0));

  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(mincost[v] < p.first)continue;

    for(int i=0; i < G[v].size(); i++){
      edge e = G[v][i];
      if(mincost[e.to] > e.cost){
	mincost[e.to] = e.cost;
	que.push(P(mincost[e.to], e.to));
      }
    }
  }
  int res=0;
  for(int i=0;i<V;i++)res+=mincost[i];
 
  return res;
}



int main(void){
  int m,a;
  char d,f;
  edge e;

  while(cin >> V,V){
    cin >> m;
    for(int i=0;i<m;i++){
      cin >> a >> d >> e.to >> f >> e.cost;
      e.cost=e.cost/100-1;
      G[a].push_back(e);
    }
      cout << Prim() << endl;
  }

  return 0;
}