$40 / 2weeks = $20 / week
5,000 dollars / (20 dollars / week) = 250 weeks.
Notice the units: dollars cancel because they appear both top and bottom of the fraction. Weeks are on the bottom of the bottom---which is the same as being on top!!
You can also set it up as follows:
5,000 dollars * (week / 20 dollars) In this format, weeks is already on top