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 fa[100005], fb[100005], fc[100005];
int main() {
  string a, b, c, ans = "";
  cin >> a >> b >> c;
  int i, j, k, l;
  for (i = 0; i < int((a).size()); i++) {
    fa[a[i] - 'a']++;
  }
  for (i = 0; i < int((b).size()); i++) {
    fb[b[i] - 'a']++;
  }
  for (i = 0; i < int((c).size()); i++) {
    fc[c[i] - 'a']++;
  }
  int times1 = INT_MAX, flag1 = 0, flag2 = 0, times2 = INT_MAX;
  for (i = 0; i < 26; i++) {
    if (fb[i]) {
      times1 = min(times1, fa[i] / fb[i]);
      flag1 = 1;
    }
  }
  for (i = 0; i < 26; i++) {
    if (fc[i]) {
      flag2 = 1;
      times2 = min(times2, fa[i] / fc[i]);
    }
  }
  int maxtimes1 = 0, maxtimes2 = 0, maxtotal = 0, curtimes2, curtimes1;
  for (i = 0; i <= times1 + times2 + 5; i++) {
    curtimes1 = INT_MAX;
    for (k = 0; k < 26; k++) {
      if (fb[k]) {
        curtimes1 = min(curtimes1, fa[k] / fb[k]);
        flag1 = 1;
      }
    }
    int t = min(i, times1);
    for (k = 0; k < 26; k++) {
      if (fb[k]) {
        fa[k] -= (t * fb[k]);
      }
    }
    curtimes2 = INT_MAX;
    for (l = 0; l < 26; l++) {
      if (fc[l]) {
        flag2 = 1;
        curtimes2 = min(curtimes2, fa[l] / fc[l]);
      }
    }
    if (curtimes2 + t > maxtotal) {
      maxtimes1 = t;
      maxtimes2 = curtimes2;
      maxtotal = curtimes2 + i;
    }
    for (k = 0; k < 26; k++) {
      if (fb[k]) {
        fa[k] += (t * fb[k]);
      }
    }
  }
  if (flag2) {
    for (i = 0; i < maxtimes2; i++) ans += c;
    for (i = 0; i < 26; i++) {
      if (fc[i]) {
        fa[i] -= maxtimes2 * fc[i];
      }
    }
  }
  if (flag1) {
    for (i = 0; i < maxtimes1; i++) ans += b;
    for (i = 0; i < 26; i++) {
      if (fb[i]) {
        fa[i] -= (maxtimes1 * fb[i]);
      }
    }
  }
  for (i = 0; i < 26; i++) {
    while (fa[i] > 0) {
      --fa[i];
      ans += i + 'a';
    }
  }
  cout << ans << endl;
  return 0;
}
