Design melodies following the assigned musical pattern while integrating the provided thematic element.
X:1
L:1/8
M:4/4
K:D
['AD (3FED', 'D2 fg afdg bgeg fdcd BAFA Addc'  
X:1
L:1/8
M:4/4
K:D
|: dB | AD (3FED AD (3FED | Adcd fedc | BE E2 BE E2 | Bded cdeg | fB B2 FB B2 | fgfe dfag | 
 fgec dBAG | FGEF D2 :: fg | afdg bgeg | fdcd BAFA | Addc defg | (3aba gb a2 fg | a3 f g3 f | 
 f3 e dfag | fdec dBAG | FGEF D2 :|  