one has to have 50, and the other has to have 20 dollars to perform this. when they both give 20 dollars, now they have 30 and 0 dollars respectively. the rich one buys the box for 30 dollars, the box which contains 40 dollars. finally they have 40 and 30 dollars. the rich one gave 10 dollars away.