Icing doughnuts problem

Question

Hints

Answer