//20
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<utility>
#include<functional>
#include<numeric>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    typedef pair<int,int> pii;
    int m;
    cin>>m;
    vector<pii> e[100];
    while(m--){
      int a,b,d;
      ((cin>>a).ignore()>>b).ignore()>>d;
      e[a].push_back(make_pair(d,b));
      e[b].push_back(make_pair(d,a));
    }
    priority_queue<pii,vector<pii>,greater<pii> > que;
    que.push(make_pair(0,0));
    vector<int> v(100,-1);
    int r=n;
    while(r--){
      pii p;
      do{
	p=que.top();
	que.pop();
      }while(v[p.second]!=-1);
      v[p.second]=p.first;
      for(int i=0;i<e[p.second].size();i++){
	que.push(make_pair(e[p.second][i].first,e[p.second][i].second));
      }
    }
    cout<<accumulate(v.begin(),v.begin()+n,0)/100-n+1<<endl;
  }
  return 0;
}