A farmer produces apple juice from different types of apples. One type costs 3 dollars per gallon, and the other type costs $3.50 per gallon to produce. He wants to mix both types to get 50 gallons of juice, so the price of production would be $3.20 per gallon. How many gallons of each type of juice he should use?