A substance constructed out of units known as nucleotides which consist of a purine or pyrimidine base linked to a pentose sugar, which in turn is esterified with phosphoric acid. Two types of nucleic acid occur in nature: deoxyribonucleic acid (DNA) and ribonucleic acid (RNA).