#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;}

//---------- union find ----------- begin
namespace UF {
#define MAX_N  10000
  int par[MAX_N], rank[MAX_N];

  void init(int n){
    int i;
    rep(i,n){ par[i] = i; rank[i] = 0;}
  }

  int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(rank[x] < rank[y]) par[x] = y;
    else {
      par[y] = x;
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  bool same(int x, int y){ return (find(x) == find(y));}
}
//---------- union find ---------- end

struct Edge {
  int from, to, cost;
/*
  Edge(int from_, int to_, int cost_){
    from = from_;
    to = to_;
    cost = cost_;
  }
*/
  bool operator < (const Edge& a) const {
    return cost < a.cost;
  }
};

int n,m;
vector<Edge> edges;

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

  while(scanf("%d",&n)){
    if(n == 0) break;

    m = in();
    edges.resize(m);
    rep(i,m) scanf("%d,%d,%d",&edges[i].from,&edges[i].to,&edges[i].cost);

    //---------- kuruskal ---------- begin
    int ans = 0;
    sort(edges.begin(),edges.end());
    UF::init(n);
    rep(i,m){
      if(UF::same(edges[i].from, edges[i].to)) continue;
      ans += (edges[i].cost / 100) - 1;
      UF::unite(edges[i].from, edges[i].to);
    }

    printf("%d\n",ans);
    //---------- kurusukal ---------- end
  }

  return 0;
}