Problem 11629 solution