#include <bits/stdc++.h>

using namespace std;

//#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

typedef pair<int, int> P;
struct edge{int to, cost;};
int n, m;
bool used[101];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    while(cin >> n) {
        if(n == 0) break;
        cin >> m;
        vector<edge> G[100];
        rep(i, m) {
            int a, b, c;
            scanf("%d,%d,%d", &a, &b, &c);
            G[a].push_back(edge{b, c / 100 - 1});
            G[b].push_back(edge{a, c / 100 - 1});
        }
        priority_queue<P, vector<P>, greater<P> > que;
        memset(used, 0, sizeof(used));
        que.push(P(0, 0));
        int res = 0;
        while(!que.empty()) {
            P p = que.top(); que.pop();
            int cst = p.first, v = p.second;
            if(used[v]) continue;
            used[v] = true;
            res += cst;
            rep(i, G[v].size()) {
                que.push(P(G[v][i].cost, G[v][i].to));
            }
        }
        cout << res << endl;
    }
    return 0;
}
