Optimized Problem 12