#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
const int MAX_N = 150;
struct edge { int to, dist; };
vector<edge> G[MAX_N];
int solve(int n)
{
    int res = 0;
    bool used[MAX_N] = {};
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, 0));
    while(not que.empty())
    {
        P p = que.top(); que.pop();
        int v = p.second;
        if(used[v]) continue;
        used[v] = true;
        res += p.first;
        for(int u = 0; u < G[v].size(); u++)
        {
            edge e = G[v][u];
            if(used[e.to] == false) que.push(P(e.dist, e.to));
        }
    }
    res /= 100;
    res -= n - 1;
    return res;
}
int main()
{
    int n;
    while(cin >> n, n)
    {
        int m; cin >> m;
        for (int i = 0; i < m; i++)
        {
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            G[a].push_back({b, d});
            G[b].push_back({a, d});
        }
        cout << solve(n) << endl;
        for(int i = 0; i < MAX_N; i++) G[i].clear();
    }
    return 0;
}


