#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  int n,m;
  int a[10000],b[10000],dis[10000];
  bool use[10000];
  int max[100][100];
  int maxnum[100][100];
  int ans;
  int tmp;

  while(1){
    cin >> n;
    if(!n)break;

    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	max[i][j] = 0;
	maxnum[i][j] = -1;
      }
    }

    cin >> m;
    for(int i=0;i<m;i++){
      scanf("%d,%d,%d",&a[i],&b[i],&dis[i]);
      if(a[i]>b[i]){
	tmp = a[i];
	a[i] = b[i];
	b[i] = tmp;
      }
      use[i] = true;
    }

    for(int i=0;i<m;i++){
      if(max[a[i]][b[i]]){
	if(max[a[i]][b[i]] < dis[i])use[i] = false;
	else use[maxnum[a[i]][b[i]]] = false;
      }else{
	max[a[i]][b[i]] = dis[i];
	maxnum[a[i]][b[i]] = i;
	for(int j=a[i];j<n;j++){
	  if(max[a[i]][j]){
	    if(j<b[i]){
	      if(max[a[i]][j]>dis[i]){
		max[j][b[i]] = max[a[i]][j];
		maxnum[j][b[i]] = maxnum[a[i]][j];
	      }else{
		max[j][b[i]] = dis[i];
		maxnum[j][b[i]] = i;
	      }
	    }else{
	      if(max[a[i]][j]>dis[i]){
		max[b[i]][j] = max[a[i]][j];
		maxnum[b[i]][j] = maxnum[a[i]][j];
	      }else{
		max[b[i]][j] = dis[i];
		maxnum[b[i]][j] = i;
	      }
	    }
	  }
	}
	for(int j=0;j<a[i];j++){
	  if(max[j][a[i]]){
	    if(max[j][a[i]]>dis[i]){
	      max[j][b[i]] = max[j][a[i]];
	      maxnum[j][b[i]] = maxnum[j][a[i]];
	    }else{
	      max[j][b[i]] = dis[i];
	      maxnum[j][b[i]] = i;
	    }
	  }
	}
	for(int j=0;j<b[i];j++){
	  if(max[j][b[i]]){
	    if(j<a[i]){
	      if(max[j][b[i]]>dis[i]){
		max[j][a[i]] = max[j][b[i]];
		maxnum[j][a[i]] = maxnum[j][b[i]];
	      }else{
		max[j][a[i]] = dis[i];
		maxnum[j][a[i]] = i;
	      }
	    }else{
	      if(max[j][b[i]]>dis[i]){
		max[a[i]][j] = max[j][b[i]];
		maxnum[a[i]][j] = maxnum[j][b[i]];
	      }else{
		max[a[i]][j] = dis[i];
		maxnum[a[i]][j] = i;
	      }
	    }
	  }  
	}
	for(int j=b[i];j<n;j++){
	  if(max[b[i]][j]){
	    if(max[b[i]][j]>dis[i]){
	      max[a[i]][j] = max[b[i]][j];
	      maxnum[a[i]][j] = maxnum[b[i]][j];
	    }else{
	      max[a[i]][j] = dis[i];
	      maxnum[a[i]][j] = i;
	    }
	  }
	}
      }
    }

    ans = 0;
    for(int i=0;i<n;i++){
      if(use[i])ans+=dis[i]-100;
    }
    cout << ans/100 << endl;
  }
  return 0;
}