initial attempt for solving problem 106