#include <iostream>
#define INF 1000000000

using namespace std;


int main(){
        int n;
        cin >> n;
        while(n){
                int m;
                cin >> m;
                int map[n][n];
                for(int i = 0; i < n ;i++){
                        for(int j = 0; j < n; j++){
                                map[i][j] = INF;
                        }   
                }   
                for(int i = 0; i < m; i++){
                        int a,b,c;
                        char d,e;
                        cin >> a >> d >> b >> e >> c;
                        map[a][b] = map[b][a] = c/100;
                }   
                bool used[100] = {false};
                used[0] = true;
                long long cost = 0;
                for(int i = 0; i < m-1; i++){
                        int min = INF;
                        int next = 0;
                        for(int j = 0; j < n; j++){
                                for(int k = 0; k < n; k++){
                                        if(used[j] && !used[k] && map[j][k] < min){
                                                min = map[j][k];
                                                next = k;
                                        }   
                                }   
                        }   
                        used[next] = true;
                        cost += min-1;
                }   
                cout << cost << endl;
                cin >> n;
        }   
}