#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
inline int in(){ int x; scanf("%d",&x); return x;}

const int INF = 1<<29;

typedef pair<int,int> P;

int g[110][110];

int main(){
  int i,j,k;
  int n,m;

  while(scanf("%d",&n)){
    if(n == 0) break;
    rep(i,n){ rep(j,n) g[i][j] = INF;}

    m = in();
    while(m--){
      int a, b, cost;
      scanf("%d,%d,%d",&a,&b,&cost);
      g[a][b] = g[b][a] = cost;
    }

//    rep(i,n){ rep(j,n) cout << g[i][j] << ' '; cout << endl;}

    int ans = 1;
    int rest = n;
    vector<int> end(n,0);
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P(0,0));
    while(!q.empty()){
      int now = q.top().second;
      int cost = q.top().first;
      q.pop();

//      cout << now << ' ' << cost << endl;

      if(end[now] == 1) continue;
      end[now] = 1;
      int tmp = (cost /100 ) -1;
//      cout << "ans " << ans << endl;
//      cout << "tmp " << tmp << endl;
      ans += tmp;
      rest--;
      if(rest == 0) break;
      rep(i,n){
//        cout << "g[now][i] " << g[now][i] << endl;
        if(!end[i] && g[now][i] != INF) q.push(P(g[now][i],i));
      }
    }

    printf("%d\n",ans);
  }

  return 0;
}