#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;


int main(){

	int n,m,table[100][100],checkTable[100],fixed[100],count,num,tmp_min,min_index,a,b,dist;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i = 0; i < n; i++){
			checkTable[i] = 0;
			for(int k = 0; k < n; k++)table[i][k] = 0;
		}

		scanf("%d",&m);

		for(int i = 0; i < m; i++){
			scanf("%d,%d,%d",&a,&b,&dist);
			table[a][b] = dist;
			table[b][a] = dist;
		}

		checkTable[0] = 1;	//0?????????????°???¨?????¨??°??????????????????
		fixed[0] = 0;
		count = 1,num = 0;

		//????°???¨?????¨??¢?????´?????????
		while(count < n){
			tmp_min = 10000000;

			//????°???¨?????¨??¨?????°?????????????????????????????????????±???????
			for(int i = 0; i < count; i++){
				for(int k = 0; k < n; k++){
					if(table[i][k] > 0 && checkTable[k] == 0 && table[i][k] < tmp_min){
						tmp_min = table[i][k];
						min_index = k;
					}
				}
			}

			num += (tmp_min/100)-1;
			checkTable[min_index] = 1;
			fixed[count] = min_index;
			count++;
		}

		printf("%d\n",num);

	}

    return 0;
}