import Control.Monad
import Data.List
import Text.Printf

inf :: Int
inf = 1000000000

initCost :: [(Int,Int,Int)]->((Int,Int)->Int)
initCost [] = cost
    where cost edge = inf
initCost ((a,b,d):xs) = cost
    where cost edge = if edge==(a,b) || edge==(b,a) then d 
                      else (initCost xs) edge

solvePrim :: ((Int,Int)->Int)->
             [Int]->[(Int,Int)]->
             [Int]->[(Int,Int)]->
             [(Int,Int)]
solvePrim cost vnew enew v e 
    | vnew==v   = enew
    | otherwise = solvePrim cost vnew' enew' v e
        where fltrfunc (x,y) = ((elem x vnew)&&(not $ elem y vnew))||
                               ((elem y vnew)&&(not $ elem x vnew))
              filtered = filter fltrfunc e
              mincost = minimum $ map cost filtered
              (x,y) = head $ filter (\x->(cost x)==mincost) filtered
              vnew' = sort $ nub $ (x:y:vnew)
              enew' = (x,y):enew

solve :: ((Int,Int)->Int)->
         [Int]->[(Int,Int)]->
         Int
solve cost v e = sum $ map (\x->(cost x)`div`100-1) res
    where res = solvePrim cost [0] [] v e 

readInput :: IO ()
readInput = do
    ln <- getLine
    let n = read ln :: Int
    if n==0 then return () else return =<< readInput' n

readInput' :: Int->IO ()
readInput' n = do
    lm <- getLine
    let m = read lm :: Int
    str <- replicateM m getLine
    let myread s = read ("("++s++")")::(Int,Int,Int)
    let list = map myread str
    let cost = initCost list
    let e = map (\(a,b,d)->(a,b)) list
    let v = [0..(n-1)]
    printf "%d\n" (solve cost v e)
    return =<< readInput

main :: IO ()
main = do
    readInput