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

#define N 100
#define F first
#define S second
typedef pair<int,int>pii;
typedef pair<int,pii>piii;

int u[N],r[N];

void init(int n){
    for(int i=0;i<n;i++){
        u[i]=i;r[i]=0;
    }
}
int find(int x){return x==u[x]?x:u[x]=find(u[x]);}

void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(r[x]<r[y])u[x]=y;
    else u[y]=x;
    r[x]+=(r[x]==r[y])?1:0;
}

bool same(int x,int y){return find(x)==find(y);}

int main(){
    int n,m;
    while(scanf("%d",&n),n){
        scanf("%d",&m);
        vector<piii>es(m);
        for(int i=0;i<m;i++){
            int a,b,c;
            scanf("%d,%d,%d",&a,&b,&c);
            c=c/100-1;
            es[i]=piii(c,pii(min(a,b),max(a,b)));
        }
        init(n);
        sort(es.begin(),es.end());
        int res=0;
        for(int i=0;i<m;i++){
            piii p=es[i];
            if(same(p.S.F,p.S.S))continue;
            unite(p.S.F,p.S.S);
            res+=p.F;
        }
        printf("%d\n",res);
    }
    return 0;

    return 0;
}