#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define FOR(i, s, n) for(int i = s; i <= (int)n; ++i)
#define per(i, n) for(int i = n; i > 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define MP make_pair
#define PB push_back
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define int long long
static const int dx[] = { -1, 0, 1, 0 };
static const int dy[] = { 0, -1, 0, 1 };
typedef pair<int,pair<int,int> > PII;
int n,m;
int ans;
int E[15000];
PII V[150];

signed main(){
    while(1){
        cin>>n;
        if(n==0)break;
        cin>>m;
        rep(i,m){
            int x,y,z;
            char c;
            cin>>x>>c>>y>>c>>z;
            V[i].first=z;
            V[i].second.first=x;
            V[i].second.second=y;
        }
        sort(V,V+m);
        rep(i,m){
            if(E[V[i].second.first]==1&&E[V[i].second.second]==1)continue;
            ans+=V[i].first-100;
            E[V[i].second.first]=1;
            E[V[i].second.second]=1;
        }
        cout<<ans/100<<endl;
        ans=0;
        rep(i,n)E[i]=0;
        rep(i,m){
            V[i].first=0;
            V[i].second.first=0;
            V[i].second.second=0;
        }
    }
    return 0;
}