Solved second problem