#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

static const int INF = 100000000;

int main(){
	int n,m;
	while(~scanf("%d",&n)){
		if(n==0) break;

		int* mincost = new int[n];
		bool* used = new bool[n];

		fill((bool*)used,(bool*)used + n,false);
		fill((int*)mincost,(int*)mincost + n,INF);


		int** cost = new int*[n];
		for(int i=0;i<n;i++){
			cost[i] = new int[n];
			for(int j=0;j<n;j++){
				cost[i][j]=INF;
			}
		}


		scanf("%d",&m);
		for(int i=0;i<m;i++){
			int from,to,dist;
			scanf("%d,%d,%d",&from,&to,&dist);
			cost[from][to] = min(cost[from][to],dist / 100 - 1);
		}

		mincost[0]=0;

		int res=0;
		while(1){
			int v=-1;
			for(int i=0;i<n;i++){
				if(!used[i] && (v==-1 || mincost[i] < mincost[v])){
					v = i;
				}
			}

			if(v==-1) break;
			used[v] = true;		
			
			for(int i=0;i<n;i++){
				mincost[v] = min(mincost[v],cost[i][v]);
			}
			
			res+=mincost[v];
		}

		cout << res << endl;

		for(int i=0;i<n;i++){
			delete[] cost[i];
		}

		delete[] cost;
	}
}