Add solution of problem 1.