Optimal Gradient Sliding and its Application to Optimal Distributed Optimization Under Similarity