Let x = number of gallons of water (which is 0% antifreeze) to be added
Then, 320 - x = number of gallons of the 80% antifreeze solution
So, 0.8(320 - x) + 0x = = 0.40(320)
256 - 0.80x = 128
-0.80x = -128
x = 160 gal
Use 160 gal of each to get the desired solution.