Solution for Problem #38