solution to the problem
345