// {{{
// 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};
// }}}

typedef pair<int,int> P;
vector<vector<P> > edge;
int main(){
    int n,m;
    for(;;){
        scanf("%d\n",&n);
        if(n==0) break;
        scanf("%d\n",&m);
        int a,b,d;
        edge=vector<vector<P> >(n,vector<P>());
        for(int i=0;i<m;i++){
            scanf("%d,%d,%d\n",&a,&b,&d);
            d=d/100-1;
            edge[a].PB(MP(d,b));
            edge[b].PB(MP(d,a));
        }
        vector<bool> isvis(n,false);
        priority_queue<P,vector<P>,greater<P> > pq;
        int ret=0;
        pq.push(MP(0,0));
        while(!pq.empty()){
            int d=pq.top().first,at=pq.top().second;
            pq.pop();
            if(isvis[at]) continue;
            isvis[at]=true;
            ret+=d;
            for(int i=0;i<edge[at].size();i++){
                if(!isvis[edge[at][i].second]){
                    pq.push(edge[at][i]);
                }
            }
        }
        printf("%d\n",ret);
    }
}