Solution for problem 37