Solved medium problem 80.