Free energy of imperfect nucleic acid helices