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 <bits/stdc++.h>
char A[100000 + 1], B[100000 + 1], C[100000 + 1];
int vfa[30];
int vfb[30];
int vfc[30];
int main() {
  FILE *fi, *fout;
  int i, na, nb, nc, min1, min2, min3, min4;
  fi = stdin;
  fout = stdout;
  scanf("%s%s%s", &A, &B, &C);
  na = strlen(A);
  for (i = 0; i < na; i++) vfa[A[i] - 'a']++;
  nb = strlen(B);
  for (i = 0; i < nb; i++) vfb[B[i] - 'a']++;
  nc = strlen(C);
  for (i = 0; i < nc; i++) vfc[C[i] - 'a']++;
  min1 = min2 = na + 1;
  min3 = min4 = na + 1;
  for (i = 0; i < 26; i++) {
    if (vfb[i]) {
      if (min1 > vfa[i] / vfb[i]) min1 = vfa[i] / vfb[i];
      if (vfc[i])
        if (min2 > (vfa[i] % vfb[i]) / vfc[i])
          min2 = (vfa[i] % vfb[i]) / vfc[i];
    }
    if (vfc[i]) {
      if (min3 > vfa[i] / vfc[i]) min3 = vfa[i] / vfc[i];
      if (vfb[i])
        if (min4 > (vfa[i] % vfc[i]) / vfb[i])
          min4 = (vfa[i] % vfc[i]) / vfb[i];
    }
  }
  if (min1 == na + 1) min1 = 0;
  if (min2 == na + 1) min2 = 0;
  if (min3 == na + 1) min3 = 0;
  if (min4 == na + 1) min4 = 0;
  if (min1 + min2 < min3 + min4) {
    min1 = min3;
    min2 = min4;
  }
  while (min1 > 0) {
    min1--;
    for (i = 0; i < nb; i++) {
      printf("%c", B[i]);
      vfa[B[i] - 'a']--;
    }
  }
  while (min2 > 0) {
    min2--;
    for (i = 0; i < nc; i++) {
      printf("%c", C[i]);
      vfa[C[i] - 'a']--;
    }
  }
  for (i = 0; i < 26; i++)
    while (vfa[i] > 0) {
      printf("%c", i + 'a');
      vfa[i]--;
    }
  return 0;
}
