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;
void print_char(int i, int n) {
  for (int j = 0; j < n; ++j) cout << char(i + 'a');
}
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  int freqa[26] = {0}, freqb[26] = {0}, freqc[26] = {0};
  for (int i = 0; i < (int)a.length(); ++i) ++freqa[a[i] - 'a'];
  for (int i = 0; i < (int)b.length(); ++i) ++freqb[b[i] - 'a'];
  for (int i = 0; i < (int)c.length(); ++i) ++freqc[c[i] - 'a'];
  int cntb_s = 1e9, cntc_s = 1e9, cntb_e = 1e9, cntc_e = 1e9;
  for (int i = 0; i < 26; ++i) {
    if (freqb[i] != 0) cntb_s = min(cntb_s, freqa[i] / freqb[i]);
    if (freqc[i] != 0) cntc_s = min(cntc_s, freqa[i] / freqc[i]);
  }
  for (int i = 0; i < 26; ++i) freqa[i] -= freqb[i] * cntb_s;
  for (int i = 0; i < 26; ++i)
    if (freqc[i] != 0) cntc_e = min(cntc_e, freqa[i] / freqc[i]);
  memset(freqa, 0, sizeof freqa);
  for (int i = 0; i < (int)a.length(); ++i) ++freqa[a[i] - 'a'];
  for (int i = 0; i < 26; ++i) freqa[i] -= freqc[i] * cntc_s;
  for (int i = 0; i < 26; ++i)
    if (freqb[i] != 0) cntb_e = min(cntb_e, freqa[i] / freqb[i]);
  memset(freqa, 0, sizeof freqa);
  for (int i = 0; i < (int)a.length(); ++i) ++freqa[a[i] - 'a'];
  if (cntb_s + cntc_e >= cntc_s + cntb_e) {
    for (int i = 0; i < cntb_s; ++i) cout << b;
    for (int i = 0; i < cntc_e; ++i) cout << c;
    for (int i = 0; i < 26; ++i)
      freqa[i] -= (freqb[i] * cntb_s) + (freqc[i] * cntc_e);
  } else {
    for (int i = 0; i < cntc_s; ++i) cout << c;
    for (int i = 0; i < cntb_e; ++i) cout << b;
    for (int i = 0; i < 26; ++i)
      freqa[i] -= (freqc[i] * cntc_s) + (freqb[i] * cntb_e);
  }
  for (int i = 0; i < 26; ++i) print_char(i, freqa[i]);
  puts("");
  return 0;
}
