#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#define fr first
#define sc second
#define INF (2 << 28)
using namespace std;

typedef pair<int, int> iiP;
struct edge{
  int to, cost; edge(){}
  edge(int to, int cost):to(to), cost(cost){}
}; 
			      
vector<vector<edge> > Graph;

int n, m;

void init(int n){
  
  Graph.resize(0), Graph.resize(n);

}

int Prim(){
  
  int ret = 0;
  vector <int> used(n, 0); 
  priority_queue<iiP, vector<iiP>, greater<iiP> > que;
  que.push(iiP(0, 0));
  while(!que.empty()){
    iiP p = que.top(); que.pop();
    if(used[p.sc]++) continue;
    ret += p.fr;
    for(int i = 0; i < Graph[p.sc].size(); i++){
      que.push(iiP(Graph[p.sc][i].cost, Graph[p.sc][i].to));
    }
  }
  return ret;

}

int main(){
  
  while(cin >> n, n){
    cin >> m;
    init(n);

    for(int i = 0; i < m; i++){
      int a, b, c; scanf("%d, %d, %d", &a, &b, &c);
      Graph[a].push_back(edge(b, c/100));
    }

    cout << Prim() - n + 1 << endl;
  }

}