Narrated Hakim bin Hizam: That in the pre-Islamic period of ignorance, he manumitted one hundred slaves and slaughtered one hundred camels (and distributed them in charity). When he embraced Islam he again slaughtered one hundred camels and manumitted one hundred slaves.

(Hakim said,) I asked Allah’s Messenger: “What do you think about some good deeds I used to practice in the pre-Islamic period of ignorance regarding them as deeds of righteousness?” Allah’s Messenger, peace be upon him, said, “You have embraced Islam alongwith all those good deeds you did.”
[3: 715- O.B. Sahih Al-Bukhari)