#include <cstdio>
#include <algorithm>
using namespace std;

const int INF = (1<<28);
int n, m, mincost[100], cost[100][100];
bool used[100];

int prim(){
    int res = 0;
    while( true ){
        int v = -1;
        for(int i = 0; i < n; i++){
            if( !used[i] && (v == -1 || mincost[i] < mincost[v] ) ){
                v = i;
            }
        }
        if( v == -1 ) break;
        used[v] = true;
        res += mincost[v];
        for(int i = 0; i < n; i++){
            mincost[i] = min(mincost[i], cost[v][i]);
        }
    }
    return res;
}

int main(){
    while( scanf("%d", &n), n ){
        scanf("%d", &m);
        for(int i = 0; i < n; i++){
            mincost[i] = INF;
            for(int j = 0; j < n; j++){
                cost[i][j] = INF;
            }
            cost[i][i] = 0;
            used[i] = false;
        }
        mincost[0] = 0;
        for(int i = 0; i < m; i++){
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            cost[a][b] = d/100-1;
            cost[b][a] = d/100-1;
        }
        printf("%d\n", prim());
    }
    return 0;
}