depends where you bought it from and how long ago.... i think, Al-mana & Partners( Offical apple dealers in qatar) offers a 1 year warranty when you purchase from them. In that case get in touch with them and you should be be able to get it done for free else you'll have to pay for the repair costs.

If you bought it from the US. Your option( if your iMac is still under warranty) is to send it out to them and get it fixed. Yes, shipping is gonna be expensive.