optimized Problem 005