Equation of state for fluids containing chainlike molecules