In a naval engagement, 1/3 of the fleet was captured, 1/6 was sunk, and 2 ships were destroyed by fire. 1/7 of the surviving ships were lost in a storm after the battle. Finally, the 24 remaining ships sailed home. How many ships were in the fleet before the engagement?