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

#include<stdio.h>
#include<stdlib.h>

int main(){
char a[100002];
char b[100002];
char c[100002];
int aa[27];
int bb[27];
int cc[27];
int aaa[27];
int aa1[27];
int aa2[27];
scanf("%s",&a);

scanf("%s",&b);

scanf("%s",&c);

int n1,n2,n3;
int k1;
for(n1=0;n1<strlen(a);n1++){
    aa[a[n1]-'a']++;
    aa1[a[n1]-'a']++;
    aa2[a[n1]-'a']++;
}

for(n2=0;n2<strlen(b);n2++){
    bb[b[n2]-'a']++;
}
for(n3=0;n3<strlen(c);n3++){
    cc[c[n3]-'a']++;
}


int x,y,x1=-1,y1=-1;
int ab[27],ba[27];

for(x=0;x<27;x++){
    if(bb[x]==0)
        continue;
    x1++;
    ab[x1]=aa[x]/bb[x];
}

int x2,y2;
for(x2=0;x2<x1;x2++){
    if(ab[x2+1]>ab[x2])
    ab[x2+1]=ab[x2];
}

for(x=0;x<27;x++){
    if(bb[x]==0)
        continue;
    if(aa[x]>=bb[x])
        aa[x]=aa[x]-bb[x]*ab[x2];
}


for(y=0;y<27;y++){
    if(cc[y]==0)
        continue;
    y1++;
    ba[y1]=aa[y]/cc[y];
}

for(x2=0;x2<y1;x2++){
    if(ba[x2+1]>ba[x2])
        ba[x2+1]=ba[x2];
}

    

int answer1;
answer1=ab[x1]+ba[y1];
int aba[1]={ab[x1]};
int bab[1]={ba[y1]};
int x11=-1;
int y11=-1;
for(x=0;x<26;x++){
    if(cc[x]==0)
        continue;

    x11++;

    ba[x11]=aa1[x]/cc[x];
}

for(x2=0;x2<x11;x2++){
    if(ba[x2+1]>ba[x2])
        ba[x2+1]=ba[x2];
}
for(x=0;x<26;x++){
    if(cc[x]==0)
        continue;
    if(aa1[x]>=cc[x])
        aa1[x]=aa[x]-cc[x]*ba[x2];
}

for(y=0;y<26;y++){
    if(bb[y]==0)
        continue;
    y11++;
    ab[y11]=aa1[y]/bb[y];
}

for(y2=0;y2<y1;y2++){
    if(ab[y2+1]>ab[y2])
        ab[y2+1]=ab[y2];
}
int answer2;
int ans=-1;
int i,j,k;
answer2=ba[x11]+ab[y11];
char newanswer[100005];
if(answer1>answer2){

    for(i=0;i<aba[0];i++){
        for(k=0;k<strlen(b);k++){
            ans++;
            newanswer[ans]=b[k];
        }
    }
    for(i=0;i<bab[0];i++){
        for(k=0;k<strlen(c);k++){
            ans++;
            newanswer[ans]=c[k];
        }
    }
    for(k=0;k<27;k++){
        for(j=0;j<(aa2[k]-bb[k]*aba[0])-cc[k]*bab[0];j++){
            ans++;
            newanswer[ans]=('a'+k);
        }
    }
}
else {
    for(i=0;i<ba[x11];i++){
        for(k=0;k<strlen(c);k++){
            ans++;
            newanswer[ans]=c[k];

        }
    }
    for(i=0;i<ab[y11];i++){
        for(k=0;k<strlen(b);k++){
            ans++;
            newanswer[ans]=b[k];
        }
    }
    for(k=0;k<27;k++){
        for(j=0;j<(aa2[k]-cc[k]*ba[x11]-bb[k]*ab[y11]);j++){
            ans++;
            newanswer[ans]=('a'+k);
        }
    }
}

for(x=0;x<strlen(a);x++)
printf("%c",newanswer[x]);
  return 0;
}
