There is an easy answer to your question, but it will restore your computer to the state it was in when you bought it, i.e. without all your files. Do you happen to have a time machine disk attached to your iMac? If so, you can reinstall the OS as well as restore all your files and apps.