#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

using lint = long long;

class UnionFind{
    vector<int> par;
    vector<long long> wei;
    int groupCount;

public:
    UnionFind(int n = 0){
        init(n);
    }

    void init(int n = 0){
        par.resize(n);
        fill(par.begin(), par.end(), -1);

        wei.resize(n);
        fill(wei.begin(), wei.end(), 0LL);

        groupCount = n;

        return;
    }

    int root(int x){
        if(par[x] < 0){
            return x;
        }
        int r = root(par[x]);
        wei[x] += wei[par[x]];
        return par[x] = r;
    }

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

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

    long long weight(int x){
        root(x);
        return wei[x];
    }

    long long diff(int x, int y){
        return weight(y) - weight(x);
    }

    bool unite(int x, int y, long long w = 0){
        w += weight(x) - weight(y);

        x = root(x);
        y = root(y);

        if(x == y){
            return false;
        }

        if(par[y] < par[x]){
            swap(x, y);
            w = -w;
        }

        par[x] += par[y];
        par[y] = x;
        wei[y] = w;
        --groupCount;

        return true;
    }

    int size(void){
        return groupCount;
    }
};

struct edge{
    int from, to;
    lint cost;

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

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;
            lint d;
            char c;
            cin >> a >> c >> b >> c >> d;
            es.push_back({a, b, d / 100LL - 1LL});
        }

        sort(es.begin(), es.end());
        UnionFind uf(n);
        lint ans = 0;
        for(int i = 0 ; i < m ; ++i){
            if(uf.unite(es[i].from, es[i].to)){
                ans += es[i].cost;
            }
        }

        cout << ans << endl;
    }

    return 0;
}
