#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cstdio>
#define reep(num1,num2,num3) for(int num1=num3;num1<num2;num1++)
#define rep(num1,num2) reep(num1,num2,0)
#define INF 1e9
using namespace std;
class edge{
public:
    int to,c;
    edge(int to,int c):to(to),c(c){}
    edge(){}
    bool operator<(const edge &a)const{
        if(c!=a.c)return c>a.c;
        return to<a.to;
    }
};
int main()
{
    int n;
    while(cin>>n,n)
    {
        bool vis[111]={false};
        vector<edge> G[111];
        int d[111];
        int m,res=0;
        cin>>m;
        rep(i,m){
            int a,b,c;
            scanf("%d,%d,%d",&a,&b,&c);
            G[a].push_back(edge(b,c));
            G[b].push_back(edge(a,c));
        }
        priority_queue<edge> PQ;
        PQ.push(edge(0,0));
        while(!PQ.empty())
        {
            edge e=PQ.top();PQ.pop();
            if(vis[e.to])continue;
            vis[e.to]=true;
            res+=e.c;
            rep(i,G[e.to].size()){
                PQ.push(edge(G[e.to][i].to,G[e.to][i].c));
            }
        }
        cout<<res/100-n+1<<endl;
    }
}