brtakoktrosttttttttttosafasfkalsfkodfdasiofhadfhasdsajfdsafoasodsafahaihfdisoadspapsapiosapdsajdipsahdhasuirhaeuifhhfkjgosooooooooodafdfioottttafdsafaddfuiasdjfjasdo
okat
tako
 aleksandrehteosidatedodam
evo
si
 goodbyeihopecontestisntsohar
oh
god
 duxidimkeetoivas
dd
odi
 hellodeninobrdo
od
hel
 ikbalturkeybelieveinyou
bal
kan
 zdule
didins
meinkraft
 cumurcumur
um
cur
 ikatanictisinajboljiuhrvatskojakoprictasovojaviseakotijedosadno
javise
sine
 zlobobermyfriendandthanksforhelp
de
for
 navijamzaradnickiastabidrugo
druzina
djavola
 saljivdzijasamjaneki
neki
ja
 bumbumdzejsikerol
bumbum
bum
 svetislavgajicpoznatijikaosvetaxxx
slavi
slavu
 princeofpersiayouhavegreatcontestbutinwrongtime
op
pera
 pozdravizamarkamatovicaaleksandracveticainenadaslagalicustanisica
vas
rad
 dreamoonhasonedream
no
no
 jankosustersicneceovoraditi
cosovic
oce
 milenicnikolaitisideotakmicenja
elem
nik
 touristyouaregreatguy
tourist
guy
 lukavpastaakojelukav
a
u
 xxxbbbcccoca
ca
cb
 aaaaaabababaaa
aa
a
 petryouaregoodandyouhavegoodblogs
blog
rega
 lebronnojameslebronprogrammers
je
bro
 mztskopjetisisampiosrcenaterenostaviajdezanaspobedi
mzt
optee
 gukimikazedauradimseminarskidodatnohumorhumor
dp
mrzime
 razredninjegosgrebovicdobarcoveklosbasketas
ne
go
 pozdravzamojeodeljenjeiprofesoreocudabudempetnula
bojan
cao
 damandicnenapravicheckerzeznulibise
man
ker
 pozdravizazenskudecunecuvasodvajatidaseneprotumacipogresno
cao
deco
 egoryouaregoodbutcantsolveeverythinginonehour
eat
your
 lemigazalemiolemilicomzalemljenje
lemi
zlo
 randomusername
umno
umno
 thisiscornercase
youhavetwolongerstrings
ibelivethatyoudontmissit
 oduleodule
xgrizx
ivanstosicprvi
 molimprofesorkuengleskogdamidapetjasamdobarcovekitrudimseiztogaiakosamoperisan
hvala
unapred
 djeneralmilomirstefanovic
radi
nesto
 balsabratepozdravimajudevojku
oj
zdrav
 iwanttothanktomygrandmaheisveryimportantpersoninmylife
thanks
stanka

takotakotakotakotakoaaaaaaaaaaaaaaaaaaaaaabddddddddddddddddddeffffffffffffffffffghhhhhhhhhiiiiiiiiijjjjjloooooooooooooooooppppprrrssssssssssssssssssssstttttttttttuuu
 siaaaaddddeeeehklmnoorstt
 ohohgodabceeeiinnooprsssttty
 odiadeeiikmstuvx
 ododhelbeilnnor
 kanbbeeeeiiikllortuuvyy
 deluz
 umumcurcur
 sinesineaaaaaaaaabccddhiiiiiijjjjjkkkklnooooooooprrssstttttuvvv
 dedeforforaabbehhikllmnnnoprstyz
 druzinaaaaaabcdgiiijkmnorstv
 nekijajajaadiilmssvz
 bumbumdeeijklorsz
 slaviaaaaceegiiijjknoopsstttvvxxxz
 peraperaabcceeeefgghiiiimnnnnoooorrsstttttuuvwy
 vasvasvasradradradaaaaaaaaaaccccceeegiiiiiiikklllmmnnnnoopstttuzz
 nonoaaaddeeehmmorrs
 oceoceaadeiiijknnorrsssttuv
 elemniknikaaaccdeiiiiijlmnoostt
 touristguyguyaaeeorrt
 aaaaauuejkkkllopstvv
 cacbcbcboxxx
 aaaaaaaaaaabbb
 blogregaregaadddehnoooooopstuuvyy
 jebrobroaaeeegllmmmnnnooprrrss
 mztopteeopteeopteeaaaaaabcddiiiiijjkmnnnorrssssssvz
 mrzimeaaaaaddddeghhiiiikkkmmmnnoooorrrsstuuuu
 nenegogoaaaabbbccddeeeiijkklooorrrrsssstvvz
 bojancaoaaddddeeeeeeeefijjllmmnooooppprrrstuuuvzz
 mankeraaabcccddeeeehiiiilnnnprsuvzz
 decodecodecoaaaaaaadeeegiiijkmnnnnooppprrrssssttuuuuvvvzzz
 eateatyouryourbcdeeeeggghhiilnnnnooooorrstuvv
 lemilemilemilemizlozloaaaceegjjmn
 umnoaadeemnrrs
 acceehiinorrssst
 ddeelloouu
 unapredunapredaaaaaaabcddeeeeefgggiiiiiiijkkkkllmmmmmmoooooooooprrrsssssstttvz
 radinestoaceefiijllmmnorv
 ojojzdravaaaabbdeeiklmprstuuv
 stankaaaadeeeefghhiiiiilmmmmnnnnnoooopprrrrstttttvwyyy

from sys import stdin, stdout
import copy
"""
    n = stdin.readline()
    arr = [int(x) for x in stdin.readline().split()]
    stdout.write(str(summation))
"""
a = input()
b = input()
c = input()
dicta = {}
dictb = {}
dictc = {}

for i in a :
    if i not in dicta :
        dicta[i] = 1
    else :
        dicta[i] = dicta[i]+1
dicta2 = copy.deepcopy(dicta)

for i in b :
    if i not in dictb :
        dictb[i] = 1
    else :
        dictb[i] = dictb[i]+1

for i in c :
    if i not in dictc :
        dictc[i] = 1
    else :
        dictc[i] = dictc[i]+1

"""###"""
minib = 1000001
for i in dictb :
    if i in dicta and dicta[i]//dictb[i] > 0:
        if dicta[i]//dictb[i] <= minib :
            minib = dicta[i]//dictb[i]
    else :
        minib = 0
        break
for i in dicta :
    if i in dictb :
        dicta[i] = dicta[i] - minib*dictb[i]
minic1 = 1000001
for i in dictc :
    if i in dicta and dicta[i]//dictc[i]>0:
        if dicta[i]//dictc[i] <= minic1 :
            minic1 = dicta[i]//dictc[i]
    else :
        minic1 = 0
        break
ans1 = minib*b + minic1*c

"""###"""
minic = 1000001
for i in dictc :
    if i in dicta2 and dicta2[i]//dictc[i]>0:
        if dicta2[i]//dictc[i] <= minic :
            minic = dicta2[i]//dictc[i]
    else :
        minic = 0
        break
for i in dicta2 :
    if i in dictc :
        dicta2[i] = dicta2[i] - minic*dictc[i]
minib2 = 1000001
for i in dictb :
    if i in dicta2 and dicta2[i]//dictb[i]>0:
        if dicta2[i]//dictb[i] <= minib2 :
            minib2 = dicta2[i]//dictb[i]
    else :
        minib2 = 0
        break
ans2 = minib2*b + minic*c

"""###"""
if minib+minic1>=minib2+minic :

    for i in dicta :
        if i in dictc :
            dicta[i] = dicta[i] - minic1*dictc[i]
            ans1 = ans1+i*dicta[i]
        else :
            ans1 = ans1+i*dicta[i]
    
    stdout.write(ans1)

else :

    for i in dicta2 :
        if i in dictb :
            dicta2[i] = dicta2[i] - minib2*dictb[i]
            ans2 = ans2+i*dicta2[i]
        else :
            ans2 = ans2+i*dicta2[i]
    
    stdout.write(ans2)