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;
const int MAX_C = 26;
const int INF = INT_MAX / 8;
string A, B, C;
int cnt[30];
int bcnt[30], ccnt[30];
pair<int, int> BthenC() {
  int b = INF, c = INF;
  for (int i = 0; i < MAX_C; i++) {
    if (bcnt[i] != 0) {
      if (cnt[i] != 0) {
        b = min(b, cnt[i] / bcnt[i]);
      } else {
        b = -INF;
      }
    }
  }
  if (b == INF || b < 0) b = 0;
  for (int i = 0; i < MAX_C; i++) {
    if (ccnt[i] != 0) {
      if (cnt[i] - b * bcnt[i] > 0) {
        c = min(c, (cnt[i] - b * bcnt[i]) / ccnt[i]);
      } else {
        c = -INF;
      }
    }
  }
  if (c == INF || c < 0) c = 0;
  return make_pair(b, c);
}
pair<int, int> CthenB() {
  int b = INF, c = INF;
  for (int i = 0; i < MAX_C; i++) {
    if (ccnt[i] != 0) {
      if (cnt[i] != 0) {
        c = min(c, cnt[i] / ccnt[i]);
      } else {
        c = -INF;
      }
    }
  }
  if (b == INF || b < 0) b = 0;
  for (int i = 0; i < MAX_C; i++) {
    if (bcnt[i] != 0) {
      if (cnt[i] - c * ccnt[i] > 0) {
        b = min(b, (cnt[i] - c * ccnt[i]) / bcnt[i]);
      } else {
        b = -INF;
      }
    }
  }
  if (c == INF || c < 0) c = 0;
  return make_pair(b, c);
}
int main(void) {
  cin >> A >> B >> C;
  for (int i = 0; i < (int)A.size(); i++) {
    cnt[A[i] - 'a'] += 1;
  }
  for (int i = 0; i < (int)B.size(); i++) {
    bcnt[B[i] - 'a'] += 1;
  }
  for (int i = 0; i < (int)C.size(); i++) {
    ccnt[C[i] - 'a'] += 1;
  }
  pair<int, int> pa = BthenC();
  pair<int, int> pb = CthenB();
  if (pa.first + pa.second >= pb.first + pb.second) {
    for (int i = 0; i < pa.first; i++) {
      cout << B;
    }
    for (int j = 0; j < MAX_C; j++) {
      cnt[j] -= pa.first * bcnt[j];
    }
    for (int i = 0; i < pa.second; i++) {
      cout << C;
    }
    for (int j = 0; j < MAX_C; j++) {
      cnt[j] -= pa.second * ccnt[j];
    }
    for (int i = 0; i < MAX_C; i++) {
      while (cnt[i] > 0) {
        cout << char('a' + i);
        cnt[i] -= 1;
      }
    }
    cout << "\n";
  } else {
    for (int i = 0; i < pb.second; i++) {
      cout << C;
    }
    for (int j = 0; j < MAX_C; j++) {
      cnt[j] -= pb.second * ccnt[j];
    }
    for (int i = 0; i < pb.first; i++) {
      cout << B;
    }
    for (int j = 0; j < MAX_C; j++) {
      cnt[j] -= pb.first * bcnt[j];
    }
    for (int i = 0; i < MAX_C; i++) {
      while (cnt[i] > 0) {
        cout << char('a' + i);
        cnt[i] -= 1;
      }
    }
    cout << "\n";
  }
  return 0;
}
