One thing I hate about these problems is that it is unclear what they want. Are the pies interchangeable? So if you only deliver 1 pie to the first location, does it matter which pie?
If the answer is yes, different pies would be counted differently: You have 12 pies, and you randomly select which place you are going to deliver them to. There are 3 choices for each pie and so there are ways of doing that.
If the pies are interchangeable, then this is harder, unless you know the formula! To distribute N items to M bins: