Carol has $30 to spend on gasoline for her car. After buying 8 gallons,she has $4 left. How much did each gallon of gasoline cost?