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 + 10];
char b[100000 + 10];
char c[100000 + 10];
long long _hash[200];
long long _hash2[200];
long long _hash3[200];
long long numb, numc;
int main() {
  while (scanf("%s%s%s", a, b, c) != EOF) {
    memset(_hash, 0, sizeof(_hash));
    memset(_hash2, 0, sizeof(_hash2));
    memset(_hash3, 0, sizeof(_hash3));
    long long len = strlen(a);
    long long len2 = strlen(b);
    long long len3 = strlen(c);
    for (int i = 0; i < len; i++) {
      _hash[a[i]]++;
    }
    for (int i = 0; i < len2; i++) {
      _hash2[b[i]]++;
    }
    for (int i = 0; i < len3; i++) {
      _hash3[c[i]]++;
    }
    numb = 1000000;
    numc = 1000000;
    for (int i = 0; i < 200; i++) {
      if (_hash2[i] != 0)
        if (_hash[i] / _hash2[i] < numb) numb = _hash[i] / _hash2[i];
      if (_hash3[i] != 0)
        if (_hash[i] / _hash3[i] < numc) numc = _hash[i] / _hash3[i];
    }
    if (numb > numc) {
      for (int i = 0; i < numb; i++) {
        for (int i = 0; i < len2; i++) printf("%c", b[i]);
      }
      for (int i = 0; i < 200; i++) {
        if (_hash2[i] != 0) _hash[i] -= numb * _hash2[i];
      }
      numc = 1000000;
      for (int i = 0; i < 200; i++) {
        if (_hash3[i] != 0)
          if (_hash[i] / _hash3[i] < numc) numc = _hash[i] / _hash3[i];
      }
      for (int i = 0; i < numc; i++) {
        for (int i = 0; i < len3; i++) printf("%c", c[i]);
      }
      for (int i = 0; i < 200; i++) {
        if (_hash3[i] != 0) _hash[i] -= numc * _hash3[i];
      }
      for (int i = 0; i < 200; i++) {
        if (_hash[i] != 0)
          for (int j = 0; j < _hash[i]; j++) printf("%c", (char)i);
      }
      printf("\n");
      continue;
    } else {
      for (int i = 0; i < numc; i++) {
        for (int i = 0; i < len3; i++) printf("%c", c[i]);
      }
      for (int i = 0; i < 200; i++) {
        if (_hash3[i] != 0) _hash[i] -= numc * _hash3[i];
      }
      numb = 1000000;
      for (int i = 0; i < 200; i++) {
        if (_hash2[i] != 0)
          if (_hash[i] / _hash2[i] < numb) numb = _hash[i] / _hash2[i];
      }
      for (int i = 0; i < numb; i++) {
        for (int i = 0; i < len2; i++) printf("%c", b[i]);
      }
      for (int i = 0; i < 200; i++) {
        if (_hash2[i] != 0) _hash[i] -= numb * _hash2[i];
      }
      for (int i = 0; i < 200; i++) {
        if (_hash[i] != 0)
          for (int j = 0; j < _hash[i]; j++) printf("%c", (char)i);
      }
      printf("\n");
      continue;
    }
  }
  return 0;
}
