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

class UnionFind
{
public:
    UnionFind(int n) : parent(n), rank(n)
    {
        for(int i = 0; i < n; ++i) parent[i] = i;
    }
    
    int root(int x)
    {
        if(parent[x] == x) return x;
        else return parent[x] = root(parent[x]);
    }
    
    bool same(int x, int y)
    {
        return root(x) == root(y);
    }
    
    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(rank[x] < rank[y]){
            parent[x] = y;
        } else {
            parent[y] = x;
            if(rank[x] == rank[y]){
                rank[x]++;
            }
        }
    }

private:
    vector<int> parent, rank;
};

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

vector<Edge> E;

int main()
{
    int n, m, a, b, c;
    while(1){
        scanf("%d", &n);
        if(n == 0) break;
        scanf("%d", &m);
        for(int i = 0; i < m; ++i){
            scanf("%d,%d,%d", &a, &b, &c);
            Edge e = {a, b, c / 100 - 1};
            E.push_back(e);
        }
        
        sort(E.begin(), E.end());
        
        UnionFind uf(n);
        int ans = 0;
        for(int i = 0; i < E.size(); ++i){
            if(!uf.same(E[i].u, E[i].v)){
                ans += E[i].cost;
                uf.unite(E[i].u, E[i].v);
            }
        }
        printf("%d\n", ans);
    }
}