Partition function and base pairing probabilities of RNA heterodimers