Why output amount calculation of pancakeswap add inputAmountWithFee to denominator

Hello, i have a question about output amount token calculation of pancakeswap. When i given input amount of token A, then calculate output amount of token B. Here is how they did:
inputAmountWithFees = inputAmount * FEES_NUMERATOR;
outputAmount = inputAmountWithFees * outputReserve / (inputReserve * FEES_DENOMINATOR + inputAmountWithFees)
I dont know why inputAmountWithFee added to denominator? Doesn't that change the fee?

Hi there,
I am trying to model Pancakeswap LP's at the moment and I cam across your question. I'm afraid I don't have an answer for you yet but I'm struggling with modelling exactly where the fee's are taken in the process.
If you are still interested in an answer, perhaps we could compare note? Or if you have an answer, I would love to know.
Thanks :slight_smile: