#include <iostream>
#include <vector>
#include <queue>
#include "stdio.h"
using namespace std;

const int INF = 10000000;

struct Edge{
    Edge(int t, int c)
        : to(t), cost(c) {}

    int to;
    int cost;
};

int cnt;
bool visited[100];
vector<Edge> G[100];
typedef pair<int, int> PII;

int prim(int start){
    int ans = 0;
    cnt = 0;
    fill(visited, visited+100, false);

    priority_queue<PII, vector<PII>, greater<PII> > que;

    que.push(PII(0, start));
    while (!que.empty()){
        int cst = que.top().first;
        int v = que.top().second;
        que.pop();
        if (visited[v]) continue;
        visited[v] = true;
        cnt++;
        ans += cst;
        for (int i = 0; i < G[v].size(); i++){
            Edge e = G[v][i];
            que.push(PII(G[v][i].cost, G[v][i].to));
        }
    }

    return ans;
} 

int main(int argc, char const *argv[]){
    int n, m;

    while (cin>>n, n){
        cin>>m;
        for (int i = 0; i < m; i++){
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            d = (d-100) / 100;
            G[a].push_back(Edge(b, d));
            G[b].push_back(Edge(a, d));
        }

        cout<<prim(0)<<endl;
    }

    return 0;
}