// {{{
// vim:filetype=cpp foldmethod=marker foldmarker={{{,}}}
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <climits>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
#define MP  make_pair
#define PB  push_back
using namespace std;
typedef long long ll;

int vx[]={1,0,-1,0},vy[]={0,1,0,-1};
// }}}

vector<int> par,rank;
vector<pair<int,pair<int,int> > > edge;
int find(int n){
    if(par[n]==n) return n;
    else return par[n]=find(par[n]);
}
void unite(int a,int b){
    int pa=find(a),pb=find(b);
    par[pa]=pb;
//    if(pa==pb) return;
//    if(rank[pa]>rank[pb]) swap(pa,pb);
//    par[pa]=pb;
//    if(rank[pa]==rank[pb]) rank[pb]++;
}
int main(){
    int n,m;
    for(;;){
        scanf("%d\n",&n);
        if(n==0) break;
        scanf("%d\n",&m);
        int a,b,d;
        edge=vector<pair<int,pair<int,int> > >(m);
        for(int i=0;i<m;i++){
            scanf("%d,%d,%d\n",&a,&b,&d);
            d=d/100-1;
            edge[i]=MP(d,MP(a,b));
        }
        par=vector<int>(n);
        rank=vector<int>(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            rank[i]=0;
        }
        sort(ALL(edge));
        int ret=0;
        for(int i=0;i<edge.size();i++){
            int a=edge[i].second.first,b=edge[i].second.second,d=edge[i].first;
            if(find(a)!=find(b)){
                ret+=d;
                unite(a,b);
            }
        }
        printf("%d\n",ret);
    }
}