Which would offset short-term capital gains first: investment interest expense or a long term capital gain?

I have an interesting dilemma where I have an investment interest expense that exceeds my net investment income. I also have a short-term capital gain and a long term capital loss. My understanding is that LT losses first offset LT gains, then any excess can be used to offset ST gains. But my ST gains would already be offset with my ability to write off the investment interest expense.

 

So, which offsets the tax impact of the ST gain - is it the LT cap loss or the investment expense? Clearly I would want the LT loss to offset the ST gain, then any excess investment expense that can't be written off because it exceeds my net investment income I could carry forward to future years to offset marginal income. This maximizes my tax reductions in the future.