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;
long long frq[3][26];
string a, b, c;
int F, S;
bool Fe, Se;
bool Ex(int id) {
  for (int i = 0; i < 26; i++) {
    if (frq[0][i] < frq[id][i]) {
      return false;
    }
  }
  return true;
}
void del(int id, int num) {
  for (int i = 0; i < 26; i++) {
    frq[0][i] -= (frq[id][i] * num);
  }
}
bool can1(int num, int id) {
  for (int i = 0; i < 26; i++) {
    if (frq[0][i] < frq[id][i] * num) return false;
  }
  return true;
}
bool can2(int num1, int num) {
  for (int i = 0; i < 26; i++) {
    if (frq[0][i] - (frq[1][i] * num1) < frq[2][i] * num) return false;
  }
  return true;
}
int main() {
  cin >> a >> b >> c;
  for (int i = 0; i < (int)a.size(); i++) frq[0][(int)a[i] - 97]++;
  for (int i = 0; i < (int)b.size(); i++) frq[1][(int)b[i] - 97]++;
  for (int i = 0; i < (int)c.size(); i++) frq[2][(int)c[i] - 97]++;
  Fe = Ex(1);
  Se = Ex(2);
  if (Fe && Se) {
    int t1, t2;
    t1 = t2 = 0;
    for (int i = 0; i <= 1e5; i++) {
      if (can1(i, 1)) {
        t1 = i;
      }
      int l = 0, r = 1e5, m;
      while (l <= r) {
        m = (l + r) >> 1;
        if (can2(t1, m)) {
          t2 = m;
          l = m + 1;
        } else
          r = m - 1;
      }
      if (t1 + t2 > F + S) {
        F = t1;
        S = t2;
      }
      t1 = t2 = 0;
    }
    del(1, F);
    del(2, S);
    for (int i = 0; i < F; i++) printf("%s", b.c_str());
    for (int i = 0; i < S; i++) printf("%s", c.c_str());
  } else if (Fe) {
    int l = 0, r = 1e5, m, j = 0;
    while (l <= r) {
      m = (l + r) >> 1;
      if (can1(m, 1)) {
        j = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    del(1, j);
    while (j--) {
      printf("%s", b.c_str());
    }
  } else if (Se) {
    int l = 0, r = 1e5, m, j = 0;
    while (l <= r) {
      m = (l + r) >> 1;
      if (can1(m, 2)) {
        j = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    del(2, j);
    while (j--) {
      printf("%s", c.c_str());
    }
  }
  for (int i = 0; i < 26; i++)
    if (frq[0][i] > 0) {
      a = "";
      while (frq[0][i]--) a += char(i + 97);
      printf("%s", a.c_str());
    }
  return 0;
}
