Solution for the Problem #1