#include <bits/stdc++.h>
using namespace std;

struct edge {
    int u, v, cost;
    bool operator<(edge const& other) const {
        return cost < other.cost;
    }
};

class union_find {
public:
    union_find(int n)
        : par_(n, -1)
    {}
    void init(int n) {
        par_.assign(n, -1);
    }

    int root(int x) {
        return par_[x] < 0 ? x : par_[x] = root(par_[x]);
    }

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) {
            return false;
        } else {
            if(par_[x] < par_[y]) {
                par_[x] += par_[y];
                par_[y] = x;
            } else {
                par_[y] += par_[x];
                par_[x] = y;
            }
            return true;
        }
    }

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

    int size(int x) {
        return -par_[root(x)];
    }

private:
    std::vector<int> par_;
};

int main() {
    int n;
    while(cin >> n, n) {
        int m;
        cin >> m;
        vector<edge> es;
        for(int i=0; i<m; ++i) {
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            es.push_back((edge){a, b, d / 100 - 1});
        }
        sort(es.begin(), es.end());
        union_find uf(n);
        int res = 0;
        for(int i=0; i<m; ++i) {
            if(!uf.same(es[i].u, es[i].v)) {
                res += es[i].cost;
                uf.unite(es[i].u, es[i].v);
            }
        }
        cout << res << endl;
    }
}
