Formulate melodies by adhering to the specified pattern and supplied motif.
X:1
L:1/8
M:4/4
K:D
['d2 fa gfed', 'EGAB cAGE'  
X:1
L:1/8
M:4/4
K:D
 ABc | d2 fa gfed | ceAe cdec | d2 fa gfed | cABc d :|[K:Dmix] BAG | EGAB cAGE | D2 FD ADFD | 
 EGAB cAGE | AdcA G :|  