#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

class UnionFindTree{
public:
    std::vector<int> parent;
    std::vector<int> rank;
 
    UnionFindTree(int n){
        parent.resize(n, 0);
        rank.resize(n, 0);
 
        for(int i = 0; i < n; i++){
            parent[i] = i;
        }
        return;
    }
    ~UnionFindTree(){
        return;
    }
 
    int find(int x){
        if(parent[x] == x){
            return x;
        }
        else{
            return parent[x] = find(parent[x]);
        }
    }
 
    void unite(int x, int y){
        x = find(x);
        y = find(y);
 
        if(x == y){
            return;
        }
 
        if(rank[x] < rank[y]){
            parent[x] = y;
        }
        else{
            parent[y] = x;
            if(rank[x] == rank[y]){
                rank[x]++;
            }
        }
    }
 
    bool is_same(int x, int y){
        return find(x) == find(y);
    }
};

class Edge{
public:
	int from;
	int to;
	int cost;

	Edge(){
		return;
	}
	~Edge(){
		return;
	}
};

bool comp(const Edge &l, const Edge &r){
	return l.cost < r.cost;
}

int main(int argc, char **argv){
	int n, m, a, b, d;
	char tmp;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(ifs >> n){
#else
	while(std::cin >> n){
#endif
		if(n == 0){ break; }

#if INPUT_FROM_FILE
		ifs >> m;
#else
		std::cin >> m;
#endif
		UnionFindTree uft(n);
		std::vector<Edge> edges(m);
		int min_cost = 0;
		
		for(int i = 0; i < m; i++){
#if INPUT_FROM_FILE
			ifs >> a >> tmp >> b >> tmp >> d;
#else
			std::cin >> a >> tmp >> b >> tmp >> d;
#endif
			edges[i].from = a;
			edges[i].to = b;
			edges[i].cost = d;
		}

		std::sort(edges.begin(), edges.end(), comp);

		for(int i = 0; i < m; i++){
			Edge &e = edges[i];
			if(!uft.is_same(e.from, e.to)){
				uft.unite(e.from, e.to);
				min_cost += e.cost - 100;
			}
		}

		int num_tourou = min_cost / 100;
		std::cout << num_tourou << std::endl;
	}


 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}
