How much can venting cool the top floors?
Ridge vent alone should cost at most a few hundred dollars on top of the roof repair. It's a matter of ripping a channel in the roof boards, laying down a mesh or molded plastic vent, and capping it with shingles. 

However, if you already have other vents lower on the roof, you probably don't want to add ridge venting. Either add more box vents or close them up and do full ridge venting. By having vents at several levels you create a flow loop that mostly bypasses the outer areas of the roof. You want flow from the soffit to high on the roof in a single loop.