#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int arive[101][101];
int main(void){
  int n,m;
  while(cin>>n>>m){
    if(n==0) break;
    int ans = 0;
    vector<pair<int,PII> > route;
    REP(i,n)REP(j,n)arive[i][j] = 1;
    REP(i,m){
      int a,b,l;
      scanf("%d,%d,%d",&a,&b,&l);
      l = (l-1)/100;
      route.push_back(pair<int,PII>(l,PII(a,b)));
    }
    sort(route.begin(),route.end());
    REP(i,route.size()){
      int a = route[i].second.first;
      int b = route[i].second.second;
      if(arive[a][b]){
        arive[a][b] = arive[b][a] = 0;
        REP(k,n)REP(i2,n)REP(j,n) arive[i2][j] = min(arive[i2][j]
            ,arive[i2][k] + arive[k][j]);
        ans += route[i].first;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}