Elena sold ice cream at the fair. One day she sold one-third of the gallons of vanilla ice cream that she had, and then gave away 3 more gallons of vanilla ice cream. At the end of the day, she had one gallon of vanilla ice cream left. Write an equation to find how many gallons of vanilla ice cream Elena had at the beginning of the day.