solved Problem 40