A gym charges $50 dollars per month after an initial membership fee. A member has paid a total of $320 after 6 months. Write an equation that gives the total cost of gym membership as a function of the length of membership (in months).