#include <cstdio>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

typedef long long ll;
//struct edge {int to, cost;};
typedef pair<int, int> P;
typedef complex<double> C;

const int INF = 99999999;
const int MAX_V = 110;
const int MAX_E = 10000;

typedef pair<int, int> edge;    //cost, to
vector<edge> G[MAX_V];
bool used[MAX_V];
int V, E;
int flag;

int prim() {
    REP(i, V) used[i] = false;
    used[0] = true;

    priority_queue<edge, vector<edge>, greater<edge>> que;
    REP(j, G[0].size()) que.push(G[0][j]);

    int res = 0;

    while (!que.empty()) {
        int cost = que.top().first, to = que.top().second;
        que.pop();
        if (!used[to]) {
            res += cost;
            used[to] = true;
            REP(j, G[to].size()) que.push(G[to][j]);
        }
    }
    return res;
}

void solve() {
    printf("%d\n", prim() - (V - 1) );
}

int main() {
    while (scanf("%d", &V),  V) {
        scanf("%d", &E);
        REP(i, E) {
            int f, t, c;
            scanf("%d,%d,%d\n", &f, &t, &c);
            c /= 100;
            G[f].pb(edge(c, t));
            G[t].pb(edge(c, f));
        }
        if (V == 1) {
            printf("0\n");
            continue;
        }
        solve();
    }
    return 0;
}