#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

#define INF 1e9

// ????????????????????£?¨?
int prim(int vertex, vector<vector<pair<int, int> > > adjlistv);

// ?????????
int main(void){
  while(true){
    // ???????????°??¨???????????°???????????????
    int n, m;
    cin >> n;
    if(n == 0){ break; }
    cin >> m;

    // ???????????±????????????????????£??\??????????????????
    vector<vector<pair<int, int> > > adjlist(n);
    for(int i = 0; i < m; i++){
      int a, b, d;
      scanf("%d,%d,%d", &a, &b, &d);
      adjlist[a].push_back(make_pair(d, b));
      adjlist[b].push_back(make_pair(d, a));
    }
  
    // ????°???¨?????¨????????????????±??????????????????????
    int length = prim(n, adjlist);
    cout << length / 100 - n + 1 << endl;
  }

  return 0;
}

// ????????????
// v: ????????°, adjlist: ??£??\?????????(first: ???????????????, second: ?????????)
int prim(int v, vector<vector<pair<int, int> > > adjlist){
  priority_queue<pair<int, int> > wait;  // ?????§???????????????????????¨?????§???????°??????????
  vector<int> result(v, INF);  // ??????i??¨??¨?????????????°??????????
  int length = 0;  // ??¨????????????

  // ??¨?????????????????????1?????¨?????????
  result[0] = 0;
  wait.push(make_pair(0, 0));
  
  // ???????????????
  while(!wait.empty()){
    // ????£?????????????????°?????????????????????????
    int newpoint = wait.top().second;
    int newcost = -wait.top().first;
    wait.pop();
    if(result[newpoint] < newcost){ continue; }

    // ???????????????????????¨?????????
    result[newpoint] = -INF;
    length += newcost;

    // ???newpoint????????\?¶???????????????????????????????????????? 
    for(int i = 0; i < adjlist[newpoint].size(); i++){
      int nextpoint =  adjlist[newpoint][i].second;
      int nextcost = adjlist[newpoint][i].first;
      // ????????¨??????????????£????????????????????°?????????????????????queue?????????
      if(result[nextpoint] > nextcost){
        result[nextpoint] = nextcost;
        wait.push(make_pair(-nextcost, nextpoint));
      }
    }
  }

  // ?????????: ??¨????????????
  return length;
}