Supermarket shopping problem

Question

Hints

Answer