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>
using namespace std;
string a, b, c;
int CountA1[26], CountA2[26];
int Count1, Count2, Count3, Count4;
int TryFirst() {
  int len = b.length();
  bool Yes = true;
  while (Yes) {
    int i = 0;
    for (; i < len; i++) {
      if (CountA1[b[i] - 'a']-- <= 0) {
        Yes = false;
        break;
      }
    }
    if (Yes)
      Count1++;
    else {
      for (; i >= 0; i--) CountA1[b[i] - 'a']++;
    }
  }
  len = c.length();
  Yes = true;
  while (Yes) {
    int i = 0;
    for (; i < len; i++) {
      if (CountA1[c[i] - 'a']-- <= 0) {
        Yes = false;
        break;
      }
    }
    if (Yes)
      Count2++;
    else {
      for (; i >= 0; i--) CountA1[c[i] - 'a']++;
    }
  }
  return Count1 + Count2;
}
int TrySecond() {
  int len = c.length();
  bool Yes = true;
  while (Yes) {
    int i = 0;
    for (; i < len; i++) {
      if (CountA2[c[i] - 'a']-- <= 0) {
        Yes = false;
        break;
      }
    }
    if (Yes)
      Count3++;
    else {
      for (; i >= 0; i--) CountA2[c[i] - 'a']++;
    }
  }
  len = b.length();
  Yes = true;
  while (Yes) {
    int i = 0;
    for (; i < len; i++) {
      if (CountA2[b[i] - 'a']-- <= 0) {
        Yes = false;
        break;
      }
    }
    if (Yes)
      Count4++;
    else {
      for (; i >= 0; i--) CountA2[b[i] - 'a']++;
    }
  }
  return Count3 + Count4;
}
int main() {
  cin >> a >> b >> c;
  int len = a.length();
  for (int i = 0; i < len; i++) {
    CountA1[a[i] - 'a']++;
    CountA2[a[i] - 'a']++;
  }
  int First = TryFirst();
  int Second = TrySecond();
  string Answ = "";
  if (First >= Second) {
    while (Count1--) Answ += b;
    while (Count2--) Answ += c;
    for (int i = 0; i < 26; i++)
      while (CountA1[i]-- > 0) Answ += (i + 'a');
  } else {
    while (Count3--) Answ += b;
    while (Count4--) Answ += c;
    for (int i = 0; i < 26; i++)
      while (CountA2[i]-- > 0) Answ += (i + 'a');
  }
  cout << Answ << endl;
  return 0;
}
