#include<iostream>
#include<vector>
#include<map>
#include<utility>
#include<algorithm>
#include<cstdlib>
#include<string>

using namespace std;

#define mp makepair

int main(){
  int n,m,k,l;
  int a,b,c;
  string data;
  pair<int,pair<int,int> > p;
  while(true){
    cin>>n;
    if(!n)break;
    vector<pair<int,pair<int,int> > > nodes;
    cin>>m;
    int num[m],count=0;
    for(int i=0;i<m;i++){
      num[i] = i;
      cin>>data;
      a = atoi(data.substr(0,data.find(",")).c_str());
      b = atoi(data.substr(data.find(",")+1,data.find(",",data.find(",")+1)).c_str());
      c = atoi(data.substr(data.find(",",data.find(",")+1)+1).c_str());
      p.first = c/100-1;
      p.second.first = a;
      p.second.second = b;
      nodes.push_back(p);
    }
    sort(nodes.begin(),nodes.end());
    for(int i=0;i<m;i++){
      if (num[nodes[i].second.first]!=num[nodes[i].second.second]){
	k = min(num[nodes[i].second.first],num[nodes[i].second.second]);
	l = max(num[nodes[i].second.first],num[nodes[i].second.second]);
	count+=nodes[i].first;
	for(int j=0;j<m;j++)if(num[j]==l)num[j] = k;
      }
    }
    cout<<count<<endl;
  }
}