At the end of the first man's visit the money present is twice the original amount
minus a thousand. Then another leaves and the money becomes twice that value
minus a thousand. The third leaves and the money becomes twice the prior value
minus a thousand. We know that this is exactly five thousand. We add a thousand
and divide by two
to get the value present after the second person leaves: 3,000.
Again, add a thousand and divide by two
to get the 2,000 present after the first
person leaves. Repeat the process to find 1,500 present originally.