Forty gallons of a 60% acid solution is obtained by mixing a 75% solution with a 50% solution. How many gallons of each solution must be used to obtain the desired mixture?