optimized Problem 004