problem 44

copied from the solution. The solution itself is hard to understand.