Firefighters ratify three-year contract