main = getContents>>=print.solve.map read.tail.words

solve::[Int]->Int
solve (d:x:as) =x+eat d as

eat::Int->[Int]->Int
eat d [] =0
eat d (a:as) | (mod d a)==0 =(div d a) + (eat d as)
    | otherwise =(div d a) + 1 + (eat d as)