An Algorithm for Stochastic and Adversarial Bandits with Switching Costs