Length-dependent energetics of (CTG)n and (CAG)n trinucleotide repeats