NAD(P)-dependent enzymes. II. Evolution of the mono- and dinucleotide binding domains