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 cnt[3][27];
int lef[27];
char in[3][100100];
int needed[27];
int main(void) {
  for (int i = 0; i < 3; ++i) {
    scanf("%s", in[i]);
  }
  for (int i = 0; i < 3; ++i) {
    int tam = strlen(in[i]);
    for (int j = 0; j < tam; ++j) {
      cnt[i][in[i][j] - 'a']++;
    }
  }
  int maior = 0;
  int qnttmp = 0;
  int qnt2tmp = 0;
  int tam = strlen(in[0]);
  bool ok = true;
  for (int i = 0; i <= tam; ++i) {
    int qnt = 0x3f3f3f3f;
    for (int j = 0; j < 27; ++j) {
      needed[j] = cnt[1][j] * i;
      if (needed[j] > 0) {
        if (cnt[0][j] >= needed[j]) {
          qnt = min(qnt, i);
          lef[j] = cnt[0][j] - needed[j];
        } else {
          ok = false;
          break;
        }
      } else {
        lef[j] = cnt[0][j];
      }
    }
    if (!ok) break;
    int qnt2 = 0x3f3f3f3f;
    for (int j = 0; j < 27; ++j) {
      if (cnt[2][j] > 0) {
        qnt2 = min(qnt2, lef[j] / cnt[2][j]);
      }
    }
    int ans = 0;
    if (qnt != 0x3f3f3f3f) {
      ans = qnt;
    }
    if (qnt2 != 0x3f3f3f3f) {
      ans += qnt2;
    }
    if (ans > maior) {
      maior = ans;
      if (qnt != 0x3f3f3f3f)
        qnttmp = qnt;
      else
        qnttmp = 0;
      if (qnt2 != 0x3f3f3f3f)
        qnt2tmp = qnt2;
      else
        qnt2tmp = 0;
    }
  }
  for (int i = 0; i < qnttmp; ++i) {
    printf("%s", in[1]);
    int tam = strlen(in[1]);
    for (int j = 0; j < tam; ++j) {
      cnt[0][in[1][j] - 'a']--;
    }
  }
  for (int i = 0; i < qnt2tmp; ++i) {
    printf("%s", in[2]);
    int tam = strlen(in[2]);
    for (int j = 0; j < tam; ++j) {
      cnt[0][in[2][j] - 'a']--;
    }
  }
  for (int i = 0; i < 27; ++i) {
    while (cnt[0][i] > 0) {
      printf("%c", (char)(i + 'a'));
      cnt[0][i]--;
    }
  }
  printf("\n");
  return 0;
}
