Open charm contribution to dilepton spectra produced in nuclear collisions at SPS energies