#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

template <typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int s, T d) : to(s), cost(d) {}
    Edge(int f, int s, T d) : from(f), to(s), cost(d) {}

    bool operator<(const Edge &e) const {
        return cost < e.cost;
    }
    bool operator>(const Edge &e) const {
        return cost > e.cost;
    }
};
#define Graph(type) vector< vector< Edge<type> > >

// ????°???¨?????¨(??????)
// Verified: AOJ GRL_2_A: Minimum Spanning Tree
template <typename T>
T prim(vector< vector< Edge<T> > > &G) {
    int V = G.size(); T ans = 0;
    vector<bool> used(V, false);
    priority_queue< Edge<T>, vector< Edge<T> >, greater< Edge<T> > > q;
    q.push(Edge<T>(0, 0, 0));
    while(!q.empty()) {
        Edge<T> temp = q.top(); q.pop();
        if(used[temp.to]) continue;
        used[temp.to] = true;
        ans += temp.cost;

        rep(i,0,G[temp.to].size()) q.push(G[temp.to][i]);
    }
    return ans;
}

int main() {
    int n, m;
    while(cin >> n) {
      if(n == 0) break;
      cin >> m;
      Graph(int) g(n);
      int a,b,d;
      rep(i,0,m) {
        scanf("%d,%d,%d", &a, &b, &d);
        d = d / 100 - 1;
        g[a].pb(Edge<int>(a,b,d));
        g[b].pb(Edge<int>(b,a,d));
      }
      int ret = prim(g);
      cout << ret << endl;
    }
    return 0;
}