Sami lives with Grandfather Ali on a vegetable farm. He'd love to go to school, but instead he helps his grandfather, who is old and can't cope with all the hard work alone. They sell their produce at the town market. One day Sami trades some eggs for a box containing four dirty old lamps. While he is cleaning one of the lamps he wishes that he and his grandfather were rich - and instantly he is presented with a pile of camel dung. The other lamps give him pair of false teeth, a baby hippopotamus, and a rug. It turns out that genies live in the lamps, but they are all dreadful failures at granting wishes.
However, Sami, not the sort of boy to be deterred, decides that he can at least use the rug. So he sets up a new stall at the market, and he puts his hopeless genies to work. And finally he gets what he has long wished for.