How is the v3 close price formula derived?

https://dydxprotocol.github.io/v3-teacher/#liquidations

Anyone has an idea on why it looks like this? How to understand this formula?

I’m able to understand this example but not the formula itself

Feel it should be:

Close Price (Short) = P × (1 + (M × V * (1 - M) / W))
Close Price (Long) = P × (1 − (M × V * (1 - M) / W))

instead, anyone has an idea?