Optimal Scaling Theorem for Random-Walk Metropolis on Product Targets