# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);
LL n, m, a[100000] = {}, x[10000][3] = {}, ans = 0;
struct edge { int cost, to; };
int  par[100000];  // ?????????????????????????´? 
int find(int x) { if (par[x] == x)return x; par[x] = find(par[x]); return par[x]; }
void unite(int x, int y) { x = find(x); y = find(y); if (x == y)return; par[x] = y; }
bool same(int x, int y) { return find(x) == find(y); }
vector<edge>vec[10000];
string S[100],str1,str2;
int main() {
	while (cin >> n&&n) {
		ans = 0;
	for(int i=0;i<100000;i++)par[i]=i;  // ????????????????????????
		cin >> m;
		for (int i = 0; i < m; i++) {
			int  a, b, c;
			char z;
			cin >> a >> z >> b >> z >> c;
			x[i][0] = min(a, b), x[i][1] = max(a, b), x[i][2] = c / 100 - 1;
		}
		for (int i = 0; i < m; i++)
			for (int j = i + 1; j < m; j++) {
				if (x[i][2] > x[j][2]) {
					for (int h = 0; h < 3; h++) {
						int a = x[i][h];
						x[i][h] = x[j][h];
						x[j][h] = a;
					}
				}
			}
		for (int i = 0; i < m; i++) {
			if (find(x[i][0]) != find(x[i][1])) {
				unite(x[i][0], x[i][1]);
				ans += x[i][2];
			}
		}
		cout << ans << endl;
	}
	return 0;
}