Solved problem 1.
Solved problem 2.