Problem 4 Finished

The program's efficiency is satisfactory.