#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<cstdio>
#include<cmath>
#include<utility>
#include<string>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000

int main(){

    int n,m;
    while(cin >> n,n != 0){
        cin >> m;
        //cout << n << m << endl;
        int a,b,length;
        char c;
        int ans = 0;
        vector<int> map(m+1,MAX_A);
        for(int i = 0;i < m;i++){
            cin >> a >> c >> b >> c >> length;
            //cout << a << " " << b << " " << length << endl;
            map[b] = min(map[b],length);
            //cout << map[b] << endl;
        }
        /*REP(m){
            cout << map[i] << endl;
        }*/

        for(int i = 1;i < m;i++){
            ans += map[i]/100-1;
            //cout << ans << endl;
        }
        cout << ans << endl;
    }

    return 0;
}
