#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
 
struct Edge{
    int a,b,d;
    bool operator<(const Edge a)const{
        return d<a.d;
    }
};
 
int par[100],rank_[100];
 
void init(int n){
    for(int i=0;i<n;i++) par[i] = i, rank_[i] = 1;
}
 
int find(int x){
    if(par[x]==x) return x;
    return par[x] = find(par[x]);
}
 
bool unite(int _a,int _b){
    int a = find(_a), b = find(_b);
    if(a==b) return false;
    if(rank_[a]>rank_[b]) par[b] = a;
    else{
        par[a] = b;
        if(rank_[a]==rank_[b]) rank_[b]++;
    }
    return true;
}
 
int main(){
    int N,M;
    while(cin >> N , N){
        init( N );
        cin >> M;
        Edge e[10000];
        for(int i = 0;i < M; i++) scanf("%d,%d,%d",&e[i].a,&e[i].b,&e[i].d);
        sort(e,e+M);
        int ans = 0;
        for(int i = 0; i < M; i++){
            if(unite(e[i].a, e[i].b)){
                ans += e[i].d/100-1;
            }
        }
        printf("%d\n" ,ans);
    }
}