// 0072
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

struct road{
	int dis;
	int v1;
	int v2;
};

int lantern(vector<road> ver){
	vector<bool> her;
	for(int i=0;i<ver.size();i++)
		her.push_back(false);

	int lan = 0;
	for(int i=0;i<ver.size();i++){
		if(her[ver[i].v1] == false || her[ver[i].v2] == false){
			lan += ver[i].dis/100-1;
			her[ver[i].v1] = true;
			her[ver[i].v2] = true;
		}
	}

	return lan;
}

int main(){
	while(1){
		int n, m, a, b, d;
		vector<road> ver;
		road v;

		cin>>n;
		if(n == 0)
			break;

		cin>>m;
		for(int i=0;i<m;i++){
			scanf("%d,%d,%d", &a, &b, &d);
			v.v1 = a;
			v.v2 = b;
			v.dis = d;
			ver.push_back(v);
		}

		sort(ver.begin(), ver.end(),[](const road& x, const road& y) { return x.dis < y.dis;});
		
		cout<<lantern(ver)<<endl;
	}
	return 0;
}