Yup, like Nick_Miller said, you're fine to take out contributions. The penalty will apply if your account isn't at least 5 years old or if you're not 59.5.
So say you contributed $5,000 per year for 3 years and it was worth $17,000. You could take out that $15,000 without penalty. I'd call your institution (hopefully Vanguard or Fidelity) and have them walk you through the process just to be thorough. They have good customer service.