loop do
  n = gets.to_i
  break if n==0
  m = gets.to_i
  table = Array.new(n){ Array.new(n){Float::INFINITY} }
  m.times do
    a,b,l = gets.split(",").map(&:to_i)
    table[a][b] = table[b][a] = l
  end
  length = table[0]
  cnt = 0
  a = [0]
  (n-1).times do
    l = length.min
    cnt += l/100 - 1
    i = length.index(l)
    a << i
    (1..(n-1)).each do |j|
      next if a.include?(j)
      length[j] = [length[j], table[i][j]].min
    end
    length[i] = Float::INFINITY
  end
  puts cnt
end