The new average cost
The new average is the total cost basis divided by the total shares: (existing shares × your average cost + money spent on the new purchase + fees) ÷ (existing shares + shares bought). Every input is clamped at zero, so a blank field simply contributes nothing.
Because the existing position keeps its full weight, each additional purchase moves the average less than the one before it. Buying the same amount again halves the distance to the new price; buying a fourth as much moves it a fifth of the way. The average can approach the current price but it never passes it, and it cannot go below the price of the last purchase.
The fee is part of that arithmetic in two ways. It is taken out of the money before the additional shares are bought, so a fixed fee buys fewer shares at that price, and it is then added into the total cost basis, so the fee sits inside the number the average is built from. Both effects push the new average up, which is why the calculator asks for the fee instead of guessing at it.