Once a ship was wrecked in a storm and only survivor left was washed up on a small inhabited island. He prayed to god to rescue him but for days there was no help and no one came to rescue him. Exhausted, one day he look around for things and built a little hut for himself using the wood from the drifted parts of wrecked ship. He felt very bad that his prayers are not listened and he have to stay here alone at this island. He collected things from around to help him live by and kept all those inside hut till he can find any help. Days were going by but one day when he was gone for scavenging food. After a while when he came back to find his hut in flames and all possession burned inside that hut. Man was broken, he lost everything he built till now. He was stunned with grief and anger. He cried and shouted looking toward sky, "Why god? why? how could you do this to me??"However early next day he was awakened by the sound of ship that was approaching that island. I was in disbelieve that a rescue ship came to save him. After man aboard-ed ship, he asked his rescuer, "How did you know I was here??" Rescuer replied, "We saw a smoke signal coming form this island." Man replied, "But I didn't even fired any smoke signal." Rescuer replied, "Didn't you start that fire to  give us smoke signal?"At that moment man realized that his prayers were heard and god have his ways to help people in need and thanked god for rescuing him. 
When things go bad, it's easy to get discourage but we shouldn't lose heart. Always believe in god even in midst of pain and suffering. 