so assuming the tank is just a big tall rectangular box-like tank.
well, the volume of a rectangular prism is simply the product of its length, height and width. So the volume for this one will be 40 * 36 * 18, or 25920 ft³.
if we fill that up to only 5/6, not the whole tank, how much is 5/6 of 25920? well, is really just their product, namely 21600 ft³.
and then we dump 1/3 of that 21600, how much is that anyway? well 1/3 of 21600 is really just their product, so 7200 ft³.
so we had 21600 ft³ of water, and dumped 7200 ft³, we're left only with 21600 - 7200, or 14400 ft³.