problem 14
printing just final solution