Coexistence of superconductivity and spin density wave in underdoped YBa2Cu4O8