#include <iostream>
#include <algorithm>
#include <stdio.h>


using namespace std;

string bom[8];

class Graph{
public:
    int a;
    int b;
    int ab;
};


bool asc( const Graph& left, const Graph& right ) {
    return left.ab<right.ab;
}




int main(void) {
    Graph gr[1000];
    
    while(1){
        int n,m;
        cin>>n;
        if(n==0)break;
        cin>>m;
        for(int i=0; i<m; i++){
            scanf("%d,%d,%d",&gr[i].a,&gr[i].b,&gr[i].ab);
            if(gr[i].a>gr[i].b)swap(gr[i].a,gr[i].b);
            //cin>>gr[i].a>>gr[i].b>>gr[i].ab;
        }
        sort(gr, gr+m, asc);
        /*for(int i=0; i<m; i++){
            cout<<gr[i].a<<" "<<gr[i].b<<" "<<gr[i].ab<<endl;
        }*/
        int check[1000]={0};
        int dist=0;
        check[gr[0].a]++;
        check[gr[0].b]++;
        dist+=gr[0].ab-200;
        while(1){
            int count=0;
            for(int i=0; i<m; i++)count+=check[i];
            if(count==m)break;
            for(int i=0; i<m; i++){
                if(check[gr[i].a]==1&&check[gr[i].b]==0){
                    check[gr[i].b]++;
                    dist+=gr[i].ab;
                    break;
                }else if(check[gr[i].b]==1&&check[gr[i].a]==0){
                    check[gr[i].a]++;
                    dist+=gr[i].ab-100;
                    break;
                }
            }
            
        }
        cout<<dist/100<<endl;
        
        
        
    }
    
    
    
    
    
    return 0;
}