Calculate gasCost to spend at end of switch