#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>

using namespace std;

struct TREE {
	int sum;
	int edge;
};


// SæÅ¬Øðßé
struct TREE *make_tree (vector <vector <int> > t, TREE **tree )
{
	int size = t.size();
	int i,j;
	int used_edge = 0;
	 
	for (i = 0; i < size; ++i){
		int n;
		int sum = 0;
		used_edge = 0;
		vector <bool> v (size, false );
		queue<int> Q;

		Q.push (i );	// i is Root 
		v[i] = true;

		while (!Q.empty() ){
			n = Q.front();
			Q.pop();
			
			for (j = 0; j < size; ++j){
				if (!v[j] && t[n][j] != 0 ){
					Q.push (j ) ;
					v[j] = true;
					sum += t[n][j];
					++used_edge;
				} // end if
			} // end for
		} // end while
//		cout << "sum: " << sum << endl;
		tree[i]->sum = sum;
		tree[i]->edge = used_edge;
	} // end for

	int res = INT_MAX;
	int min_index = -1;
	for (i = 0; i < size; ++i){
		if (tree[i]->sum < res ){
			res = tree[i]->sum;
			min_index = i;
		} // end if
	} // end for

	return tree[min_index];
}

void disp_table ( vector <vector <int> > t )
{
	int size = t.size();
	int len  = t[0].size();
	int i,j;

	for (i = 0; i < size; ++i){
		for (j = 0; j < len; ++j){
			cout << setw(4) << t[i][j] << ' ';
		} // end for
		cout << endl;
	} // end for
	cout << endl;
}
	
int main()
{
//	cut here before submit 
//	freopen("testcase.cdl", "r", stdin);

	string str = "";
	int n,m;	// n: jÕÌÓ m: jÕðÔ¹Ì

	while (getline (cin, str ) ) {
		stringstream ssn(str);
		ssn >> n;
		if (n == 0){
			break;
		} // end if
		getline (cin, str );
		stringstream ssm(str);
		ssm >> m;

		int i;
		int sum = 0;
		vector <vector <int> > table (n, vector <int> (n, 0 ) );
		for (i = 0; i < m; ++i){
			int from, to, dist;
			getline (cin, str );
				while (str.find(',') != string::npos ){
				str = str.replace(str.find(','), 1, " ");
			} // end while
			stringstream ss(str);
			ss >> from >> to >> dist;
			table[from][to] = dist;
			table[to][from] = dist;
		} // end for
//		disp_table (table );
	
//		TREE **root = talloc (n );
		TREE *tree[n];

		for (i = 0; i < n; ++i){
			 tree[i] = new TREE;
		} // end for

		TREE *mintree;

		mintree = make_tree (table , tree);
//		cout << "min_sum: " << mintree->sum << endl;
//		cout << "edge:    " << mintree->edge << endl;

		int res = ((mintree->sum)/100 - mintree->edge );
		cout << res << endl;

		for (i = 0; i < n; ++i){
			delete tree[i];
		} // end for

	} // end while

	return 0;
}