Student Council held a bake sale to raise money for the local food pantry. They sold a total of 40 items which included pies and cakes. Pies were $10 each and cakes were $8 each. They raised $356. How many pies and how many cakes did they sell?