#include <cstdio>   
#include <algorithm>   
using namespace std;   
  
const int MAX_N = 100, MAX_M = MAX_N * MAX_N;   
  
int par[MAX_N]; // e   
int rank[MAX_N]; // ØÌ[³   
  
// nvfÅú»   
void init_union_find(int n)   
{   
    for (int i = 0; i < n; i++)   
    {   
        par[i] = i;   
        rank[i] = 0;   
    }   
}   
  
// ØÌªðßé   
int find_union_find(int x)   
{   
    if (par[x] == x)   
        return x;   
    else  
        return par[x] = find_union_find(par[x]);   
}   
  
// xÆyÌ®·éWð¹   
void unite_union_find(int x, int y)   
{   
    x = find_union_find(x);   
    y = find_union_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]++;   
    }   
}   
  
// xÆyª¯¶WÉ®·é©Û©   
bool same_union_find(int x, int y)   
{   
    return find_union_find(x) == find_union_find(y);   
}   
  
struct edge { int u, v, cost; };   
  
bool comp(const edge &e1, const edge &e2)   
{   
    return e1.cost < e2.cost;   
}   
  
// üÍ   
int n, m;   
edge es[MAX_M];   
  
int kruskal()   
{   
    std::sort(es, es + m, comp);   
    init_union_find(n);   
    int res = 0;   
    for (int i = 0; i < m; i++)   
    {   
        edge e = es[i];   
        if (!same_union_find(e.u, e.v))   
        {   
            unite_union_find(e.u, e.v);   
            res += e.cost;   
        }   
    }   
    return res;   
}   
  
void solve()   
{ 
    printf("%d\n", kruskal());   
}   
  
int main()   
{   
    while (scanf("%d", &n) && n)   
    {   
        scanf("%d", &m);   
        for (int i = 0; i < m; i++)   
        {   
            int a, b, d;   
            scanf("%d,%d,%d", &es[i].u, &es[i].v, &es[i].cost);   
            es[i].cost = es[i].cost / 100 - 1;   
        }   
  
        solve();   
    }   
  
    return 0;   
}  