say for example the first 5 apples you buy cost .50 and the next 5 apples you buy after that cost .40 and every apple after that is .30.

How would I go about creating a function that could tell okay apples 1-5 cost .50 then add any extra in range 5-10 for the value of .40 and then every apple after that costing .30?