while(n=gets.to_i)>0
l=(1..n).map{{}}
gets.to_i.times{a,b,c=eval"[#{gets}]";;l[a][b]=l[b][a]=c/100-1}
m=(1..n-1).to_a
s=0
o=[0]
(n-1).times{
a,b=o.product(m).min_by{|i,j|l[i][j]||1e9}
s+=l[a][b]
m-=[b]
o+=[b]
}
p s
end