#include<stdio.h>
#include<string.h>
#define MAX 100
#define INT_MAX 2000000

int N;
int M[MAX][MAX];

void prim(){
//    dist = 0.0;
    
    char visited[MAX];
    int cost[MAX];
    int pi[MAX];
    int i;
    for (i = 0; i < N; i++ ){
        visited[i] = 0;
        cost[i] = INT_MAX;
    }
    
    cost[0] = 0;
    pi[0] = -1;
    
    while ( 1 ){
        int mincost = INT_MAX;
        int u;
        // cost ªÅ¬ÆÈém[h u ðIð·é
        for (i = 0; i < N; i++ ){
            if ( !visited[i] && cost[i] < mincost ){
                mincost = cost[i];
                u = i;
            }
        }
        
        // ·×ÄÌm[hª MST ÉÜÜê½Æ«
        if ( mincost == INT_MAX ) break;
        
        visited[u] = 1;
        int v;
        for (  v = 0; v < N; v++ ){
            if ( visited[v] || M[u][v] == INT_MAX ) continue;
            // XV
            if ( M[u][v] < cost[v] ){
                cost[v] = M[u][v];
                pi[v] = u;
            }
        }
    }
	int j=0;
	for(i=0;i<N;i++){
		j+=M[i][pi[i]];
	}
	printf("%d\n",j);
}

int main(){
	int m,i,j,a,b,c;
	
	while(~scanf("%d",&N)){
		if(N==0) break;
		
		for(i=0;i<N;i++){
			for(j=0;j<N;j++){
				M[i][j]=INT_MAX;
			}
		}
		
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%d,%d,%d",&a,&b,&c);
			M[a][b]=c/100-1;
			M[b][a]=c/100-1;
		}
		
		prim();
	}
	return 0;
}