added solution for the problem 4