Implement problem 1