Math Help - Lowest Cost for Multiple Pricing Plans, Quantity, and Total Minutes

1. Lowest Cost for Multiple Pricing Plans, Quantity, and Total Minutes

Ok, I'm embarrased that I even have to ask this question, but here it goes.

I would like to calculate the lowest overall price for Cellular minute pricing plans.

Plan A: 400 Minutes @ $49.99 Plan B: 1000 Minutes @$74.99
Plan C: 2000 Minutes @ \$99.99

I want a formula that will solve the below problem, and numerous others with the same format:

I want the best combination of plans to get the lowest cost per minute for a given number of phone lines and minutes.

EX: If I need 52 (X) lines of service and need a total pool of 31200 (y) minutes, what formula will give me the lowest average price per minute, or the lowest overall cost using the best combination of the three available pricing plans?

Thanks!