If you are doing an extract batch you can pre-cool any top off water needed to reach your full capacity and gravity. This is where the math comes in. The priority should be on reaching appropriate gravity not volume. If you want more beer, brew again. I set my carboy in the ice bath with the top off water. Take a gravity reading of the boiling wort with about 10-20 minutes left in boil. This will allow time for it to cool.
The kettle gravity reading, say 1.060. would be 60 points.
Say you had 3 gallons, 180 points. 180/final volume will give you your Original gravity.
say 4 gallons, 180/4= 45 or OG 1.045