Optimal Distributed Dynamic Advertising