#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

#define INF 1000010
#define MAX_V 110

using namespace std;

int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int V;

int prim(){
    for(int i=0; i < V; ++i){
        mincost[i] = INF;
        used[i] = false;
    }
    mincost[0] = 0;
    int res = 0;

    while(true){
        int v = -1;
        for(int u=0; u < V; u++){
            if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
        }

        if(v == -1) break;
        used[v] = true;
        res += mincost[v];

        for(int u=0; u < V; u++){
            mincost[u] = min(mincost[u], cost[v][u]);
        }
    }
    return res;
}

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

        for(int i=0; i < MAX_V; i++) for(int j=0; j < MAX_V; j++) cost[i][j] = INF;

        V = n;
        int m;
        cin >> m;
        for(int i=0; i < m; i++){
            int a, b, c;
            scanf("%d,%d,%d", &a, &b, &c);
            cost[a][b] = c;
            cost[b][a] = c;
        }

        cout << prim()/100-n+1 << endl;
    }
}