Solved medium problem 78.