Formulate melodies by adhering to the specified pattern and supplied motif.
X:1
L:1/8
M:2/2
K:D
['dfed BcdB AD (3(FED)', 'd2 faag fddf gfga'  
X:1
L:1/8
M:2/2
K:D
 dfed BcdB | AD (3(FED) FAAB | defd B2 (dB) | ABdf gfef | dfed BcdB | AD (3(FED) (FA) A2 | 
 defd B2 (dB) | ABdf e2 d2 || faag fddf | gfga beeg | faaf gedB | ABdf e2 d2 | faag fddf | 
 gfga bgeg | faaf gedB | ABdf gfef |]  