Started working on Problem9 solution