#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

//#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


class UnionFind{

private:
    vector<int> rank,p;

    void makeSet(int x){
      p[x] = x;
      rank[x] = 0;
    }

  public:
      UnionFind(){};
      UnionFind(int size){
        rank.resize(size,0);
        p.resize(size,0);
        for(int i = 0; i < size; i++){
          makeSet(i);
        }
      }

    bool same(int x, int y){
      return  find(x) == find(y);
    }

    void unite(int x, int y){
      link(find(x), find(y));
    }

    int find(int x){
      if(x != p[x]) p[x] = find(p[x]);
      return p[x];
    }

private:
    void link(int x, int y){
      if(rank[x] > rank[y]){
        p[y] = x;
      }else{
        p[x] = y;
        if(rank[x] == rank[y]) rank[y]++;
      }
    }

};

struct edge{
    int from, to, cost;

    bool operator<(const edge& e) const {
        return cost < e.cost;
    }

};

int kruskal(vector<edge> es, int v){

    sort(es.begin(), es.end());

     UnionFind uf(v);

     int ret = 0;

     for(int i = 0 ; i < es.size() ; i++){

         edge e = es[i];

         if(!uf.same(e.from, e.to)){
             uf.unite(e.from, e.to);
             ret += e.cost;
         }

     }

     return ret;

}


signed main(void) {
    int n,m;
    while(cin >> n,n){
        cin >> m;
        vector<edge> g;
        rep(i,m){
            edge e;
            scanf("%d,%d,%d", &e.from, &e.to, &e.cost);
            e.cost /= 100;
            e.cost--;
            g.push_back(e);
        }
        cout << kruskal(g,n) << endl;
    }
}

