#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
const int INF=100000000;
int main(){
    int n,m;
    while(cin>>n,n){
        cin>>m;
        int d[100],to[100];
        bool f[100]={0};
        fill(d,d+100,INF);
        while(m--){
            int a,b,c;
            scanf("%d,%d,%d",&a,&b,&c);
            c=c/100-1;
            if(d[a]>c){
                d[a]=c;
                to[a]=b;
            }
            if(d[b]>c){
                d[b]=c;
                to[b]=a;
            }
        }
        int sum=0;
        for(int i=0;i<n;i++){
            if(!f[i]){
                f[i]=true;
                f[to[i]]=true;
                sum+=d[i];
            }
        }
        cout<<sum<<endl;
    }
}