The cost of a gym membership is a onetime fee of $140, plus a monthly fee of $40, Brendan wrote a check for $500 to pay his gym membership for a certain

number of months, including the onetime fee. How many months of the members did he pay?