#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cfloat>
#include<cmath>
#include<map>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

typedef unsigned int uint;
typedef long long ll;

using namespace std;

#define MAX (100000000)

int main(){
  int n;
  while(scanf("%d",&n), n){
    int m;
    vector<bool> f(n, false);
    vector<vector<int> > g(n, vector<int>(n, MAX));
    int ans = 0;
    scanf("%d",&m);
    REP(i,m){
      int a,b,c;
      scanf("%d,%d,%d",&a,&b,&c); c/=100;
      g[a][b] = g[b][a] = c - 1;
    }
    f[0] = true;
    REP(k, n-1){
      int a,b,s;
      s = MAX;
      REP(i, n) REP(j, n) if(f[i] != f[j]){
        if(s > g[i][j]){
          a = i; b = j; s = g[i][j];
        }
      }
      f[a] = f[b] = true;
      ans += s;
    }
    printf("%d\n",ans);
  }
  return 0;
}