class Node
  attr_reader :id
  @@i = 0
  def self.clear
    @@i = 0
  end
  def initialize
    @u = nil
    @id = @@i
    @@i += 1
  end

  def ==(other)
    return find().id == other.find.id
  end
  def find()
    if @u
      return @u = @u.find()
    else
      return self
    end
  end

  def join(other)
    if @u
      @u.find.join(other)
    else
      @u = (other.find == (self)) ? nil : other.find
    end
  end
end

def main
  while (n = gets.to_i) != 0
    m = gets.to_i
    nodes = Array.new(n){Node.new}
    path = Array.new(m){gets.chomp.split(",").map(&:to_i)}.sort_by{|(a, b, c)|c}
    puts path.map{|r|
      unless nodes[r[0]] == nodes[r[1]]
        nodes[r[0]].join(nodes[r[1]])
        r[2] - 100
      else
        0
      end}.reduce(0){|a, i|a + i / 100}
    Node.clear
  end
end
main