All correct mate well done on that one it was hard
The contents or the ten envelopes (in dollar bills) should be as follows: $1, 2, 4, 8, 16, 32, 64, 128, 256, 489. The first nine numbers are in geometrical progression, and their sum, deducted from 1,000, gives the contents of the tenth envelope.
Fill up the 3 gallon container and pour the 3 gallons into the 5 gallon container.
Then, fill the 3 gallon container back up, and pour it into the 5 gallon container.
The 3 gallon container will have 1 gallon left.
Empty the 5 gallon container.
Pour the remining 1 gallon into the 5 gallon container.
Then fill the 3 gallon container back up and pour it into the 5 gallon container.
Thus, you have 4 gallons.