solved problem 112 poorly