Solved problem 30, 31, 112