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

#define rep(i,j) for(int i=0; i<j; i++ )
#define INF 10000000

int main(){
    int n;
    while( scanf("%d",&n), n ){
        int m;
        int map[100][100];
        scanf("%d", &m);
        rep(i,100) rep(j,100) map[i][j] = INF;
        rep(i,m){
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            map[a][b] = map[b][a] = d;
        }
        int count=0, memo[100], minIndex = 0;
		bool used[100];
        rep(i,n){
			memo[i] = map[0][i];
			used[i] = false;
		}
		memo[0] = INF;
		used[0] = true;
        rep(i,n-1){
            rep(j,n){
                if( memo[j] < memo[minIndex] ){
                    minIndex = j;
                }
            }
			count += memo[minIndex]/100-1;
			used[minIndex] = true;
			memo[minIndex] = INF;
			rep(j,n)
				if( !used[j] )
					memo[j] = min( memo[j], map[minIndex][j] );
        }
		printf("%d\n", count);
    }
    return 0;
}