while n = gets.to_i
  break if n == 0
  root = Array.new(n){|i| i}
  node = {}
  n.times{|i|
    node[i] = [i]
  }
  m = gets.to_i
  edge = []
  m.times{|i|
    a, b, d = gets.chomp.split(",").map(&:to_i)
    a, b = b, a if a > b
    edge[i] = [d/100 - 1, a, b]
  }
  edge.sort!
  sum = 0
  while edge.size > 0
    d, a, b = edge.shift
    ra = root[a]
    rb = root[b]
    if ra != rb
      node[ra] += node[rb]
      node[rb].each{|i|
        root[i] = ra
      }
      sum += d
    end
  end
  p sum
end