Fill the tank ASAP with the highest available octane gas (the highest I've seen is 93). If 93 isn't available, then 91 octane at a minimum. The added fuel will dilute the remaining 87. Whenever there is room for a couple of gallons in the, refill again with 93 or 91 octane gas.
The engine management computer will sort things out after a bit of driving.
A better (more involved) procedure would be to remove the remaining gas from the tank, and then refill it, but that's not really necessary to go to that bother.
The issue with the lower octane gas is that it's not compatible with an engine that runs at a higher compression ratio. It's okay to use gas with an octane HIGHER than specified, but not LOWER.
The issue with the lower octane gas is that it's not compatible with engines that run at higher compression. The engine is pinging (pre-ignition), and the engine management computer is making adjustments to compensate as best it can. The best remedy is to feed the engine fuel with a net octane rating of 91 or higher.
BTW... don't bother adding an "octane booster" (readily available from any auto parts store willing to take your money in exchange for snake oil.) The most suitable "octane booster" to add in your situation would be toluene, also acceptable would be xylene. You can add, but the most important thing is getting a 91 or higher octane into the tank ASAP.
(Note that there are lots of reasons an engine will be "running horrible", other than lower octane gas causing pinging and the engine control module trying to compensate.)