#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#define strtok_r strtok_s
#endif

#define ITER(c)             __typeof__((c).begin())
#define FOREACH(it, c)      for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)            __typeof__((c).rbegin())
#define RFOREACH(it, c)     for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)           REPEAT(i, 0, n)
#define RREP(i, n)          RREPEAT(i, 0, n)
#define REPEAT(i, k, n)     for(int i = (k); i < (k+n); ++i)
#define RREPEAT(i, k, n)    for(int i = (k)+(n)-1; i >= (k); --i)
#define FROMTO(i,f,t)       for(int i = f; i < t; i++)
#define ALL(c)              (c).begin(), (c).end()
#define LLPOW(p1,p2)        ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)          (sizeof(A)/sizeof((A)[0]))
#define CIN_NO_SYNC         do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)           fgets((p), sizeof(p), stdin)
#define CHOMP(p)            do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define FILL(m,v)           memset(m, v, sizeof(m))
#define mp                  make_pair
#define pb                  push_back
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;} 

typedef long long ll;
typedef unsigned long long ull;

#define X real()
#define Y imag()
typedef double D;
typedef complex<D> P;
#define EPS (1e-9)

#ifdef _DEBUG
template<class _T>
inline void _prfe(const char *_n, _T _c, bool _p = false){
    ITER(_c) _it=_c.begin();
    if(_p){ cout<<_n<<" = ["<<endl;for(;_it!=_c.end();++_it)cout<<"    "<<*_it<<endl;cout<<"]"<<endl; }
    else{ cout<<_n<<" = [ "<<*_it++;for(;_it!=_c.end();++_it)cout<<", "<<*_it;cout<<" ]"<<endl; }
}
#define pf printf
#define pr(n) do{cout<<#n" = "<<(n)<<endl;}while(0)
#define prfe(n) _prfe(#n, n)
#define prfep(n) _prfe(#n, n, true)
#define dbgchk(n) do{if(n)throw;}while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#define prfe(...) /* */
#define prfep(...) /* */
#define dbgchk(...) /* */
#endif

template <class _Tn>
class UnionFind {
    int m_node;
    vector<_Tn> node;
public:
    UnionFind(int n = 0){ init(n);}
    void init(int n){ m_node = n; node = vector<_Tn>(n,-1); }
    bool connect(_Tn n1, _Tn n2){
        dbgchk(n1 < 0 || n2 < 0 || n1 >= m_node || n2 >= m_node);
        n1 = root(n1); n2 = root(n2);
        if(n1 == n2) return false;
        if(node[n1] > node[n2]) swap(n1,n2);
        node[n1] += node[n2]; node[n2] = n1;
        return true;
    }
    bool is_connect(_Tn n1, _Tn n2){ return root(n1) == root(n2); }
    _Tn root(_Tn n){
        dbgchk(n < 0 || n >= m_node);
        return (node[n] < 0) ? n : root(node[n]);
    }
    int size(_Tn n){
        idbgchkf(n < 0 || n >= m_node);
        return -node[root(n)];
    }
    void dbgprint(){
        REP(i,m_node){
            if(node[i] >= 0) continue;
            printf("(%d:%d", -node[i], i);
            REP(j,m_node){
                if(i == j) continue;
                if(root(j) == i) printf(",%d", j);
            }
            printf("),");
        }
        printf("\n");
    }
};

template <class _T1, class _T2>
class kruskal_branch {
public:
    _T1 node1, node2;
    _T2 weight;
    kruskal_branch(_T1 n1, _T1 n2, _T2 w) : node1(n1), node2(n2), weight(w) {;}
    bool operator> (const kruskal_branch<_T1, _T2> &p) const { return (weight > p.weight); }
};

template <class _T1, class _T2>
class kruskal {
public:
    typedef kruskal_branch<_T1,_T2> kruskal_branch_t;
    typedef priority_queue<kruskal_branch_t, vector<kruskal_branch_t>, greater<kruskal_branch_t> > kruskal_queue_t;
private:
    int m_nodes;
    kruskal_queue_t queue, mintree;
    UnionFind<_T1> node;
public:
    kruskal() : m_nodes(0){;}
    void nodenum_set(int n){ m_nodes = MAX(m_nodes, n); }
    void branch_add(kruskal_branch_t &b){
        dbgchk(b.node1 < 0 || b.node2 < 0);
        queue.push(b); m_nodes = MAX(m_nodes, MAX(b.node1+1, b.node2+1));
    }
    kruskal_queue_t &get_mintree(void){ return mintree; }
    UnionFind<_T1> &get_node(void){ return node; }

    _T2 solve(){
        _T2 totalcost = 0;
        node.init(m_nodes);
        for(; !queue.empty(); queue.pop()){
            const kruskal_branch_t &b = queue.top();
            if(!node.is_connect(b.node1, b.node2)){
                mintree.push(b);
                totalcost += b.weight;
                node.connect(b.node1, b.node2);
            }
        }
        return totalcost;
    }
};

typedef kruskal<int,int> kruskal_t;
typedef kruskal_t::kruskal_queue_t kruskal_queue_t;
typedef kruskal_t::kruskal_branch_t kruskal_branch_t;

int solve(int n, kruskal_t &k){
    k.solve();
    kruskal_queue_t &mintree = k.get_mintree();

    int total = 0;
    for(; !mintree.empty(); mintree.pop()){
        const kruskal_branch_t &b = mintree.top();
        pf("node1 = %d, node2 = %d, weight = %d\n", b.node1, b.node2, b.weight);
        total += b.weight;
    }
    return total;
}

int main(){
    int n, m, a, b, r;

    while(cin >> n, n){
        kruskal_t k;
        cin >> m;
        REP(i,m){
            string s;
            cin >> s;
            sscanf(s.c_str(), "%d,%d,%d", &a, &b, &r);
            kruskal_branch_t branch(a, b, r/100-1);
            k.branch_add(branch);
        }
        cout << solve(n, k) << endl;;
    }
    return 0;
}

Measured memory_bytes: 1416