INF = 1.0 / 0.0

class Node
  attr_accessor :edge, :visited
  def initialize
    @edge = {}
    @visited = false
  end
end

def dfs(s, g)
  q = [s]
  g[s].visited = true
  ans = 0
  while q.size > 0
    s = q[-1]
    min = INF
    u = s
    g[s].edge.each{|t, d|
      next if g[t].visited
      if min > d
        min = d
        u = t
      end
    }
    if u != s
      q << u
      g[u].visited = true
      ans += min
    else
      q.pop
    end
  end
  return ans
end

while n = gets.to_i
  break if n == 0
  g = Array.new(n){Node.new}
  m = gets.to_i
  m.times{|i|
    a, b, d = gets.chomp.split(",").map(&:to_i)
    g[a].edge[b] = d / 100 - 1
    g[b].edge[a] = d / 100 - 1
  }
  p dfs(0,g)
end