Solution for problem 144