A certain preparation consists of liquids X, Y, and Z in the proportion 3:4:2. How many gallons of the preparation can be made from a stock of materials consisting of 10 gallons of X, 20 gallons of Y, and 30 gallons of Z?
a) 30 gallons
b) 40 gallons
c) 50 gallons
d) 60 gallons