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;
int charA[27], charB[27], charC[27];
void decByC() {
  for (int j = 0; j < 27; j++) charA[j] -= charC[j];
}
void decByB() {
  for (int j = 0; j < 27; j++) charA[j] -= charB[j];
}
int findCountC() {
  int tempCountC = 1000007;
  for (int j = 0; j < 27; j++) {
    if (charC[j] != 0) {
      if (charA[j] / charC[j] < tempCountC) tempCountC = charA[j] / charC[j];
    }
  }
  return tempCountC;
}
int findCountB() {
  int tempCountB = 1000007;
  for (int j = 0; j < 27; j++) {
    if (charB[j] != 0) {
      if (charA[j] / charB[j] < tempCountB) tempCountB = charA[j] / charB[j];
    }
  }
  return tempCountB;
}
void restartC(int countC) {
  for (int i = 0; i < 27; i++) charA[i] += charC[i] * countC;
}
void restartB(int countB) {
  for (int i = 0; i < 27; i++) charA[i] += charB[i] * countB;
}
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  for (int i = 0; i < a.length(); i++) charA[a[i] - 'a']++;
  for (int i = 0; i < b.length(); i++) charB[b[i] - 'a']++;
  for (int i = 0; i < c.length(); i++) charC[c[i] - 'a']++;
  int maxAns = 0, maxCountB = 0, maxCountC = 0;
  int countB = findCountB();
  for (int i = 1; i <= countB; i++) {
    decByB();
    int tempCountC = findCountC();
    if (maxAns < tempCountC + i) {
      maxAns = tempCountC + i;
      maxCountC = tempCountC;
      maxCountB = i;
    }
  }
  restartB(countB);
  int countC = findCountC();
  for (int i = 1; i <= countC; i++) {
    decByC();
    int tempCountB = findCountB();
    if (maxAns < tempCountB + i) {
      maxAns = tempCountB + i;
      maxCountB = tempCountB;
      maxCountC = i;
    }
  }
  restartC(countC);
  for (int i = 0; i < maxCountB; i++) cout << b;
  for (int i = 0; i < maxCountC; i++) cout << c;
  for (int i = 0; i < 27; i++)
    charA[i] -= (charB[i] * maxCountB + charC[i] * maxCountC);
  for (int i = 0; i < 27; i++) {
    while (charA[i]) {
      cout << (char)(i + 'a');
      charA[i]--;
    }
  }
  return 0;
}
