Selection in complex genetic systems IV. Multiple alleles and interactions between two loci