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;
char a[100050], b[100050], c[100050];
int a1[30], b1[30], c1[30], Temp[30];
int main() {
  scanf("%s%s%s", a, b, c);
  int i, j, k, s1 = 100050, s2 = 100050, sum = 0, temp = 0, m = 0, n = 0;
  for (i = 0; i < strlen(a); i++) a1[a[i] - 'a' + 1]++;
  for (i = 0; i < strlen(b); i++) b1[b[i] - 'a' + 1]++;
  for (i = 0; i < strlen(c); i++) c1[c[i] - 'a' + 1]++;
  for (i = 1; i <= 26; i++) {
    if (b1[i] == 0) continue;
    temp = a1[i] / b1[i];
    s1 = s1 < temp ? s1 : temp;
  }
  for (i = 1; i <= 26; i++) {
    if (c1[i] == 0) continue;
    temp = a1[i] / c1[i];
    s2 = s2 < temp ? s2 : temp;
  }
  if (s1 > s2) {
    for (i = 1; i <= s1; i++) {
      for (j = 1; j <= 26; j++) Temp[j] = a1[j];
      for (j = 0; j < strlen(b); j++) Temp[b[j] - 'a' + 1] -= i;
      s2 = 100050;
      for (k = 1; k <= 26; k++) {
        if (c1[k] == 0) continue;
        temp = Temp[k] / c1[k];
        s2 = s2 < temp ? s2 : temp;
      }
      if (s2 + i > sum) {
        sum = s2 + i;
        m = i;
        n = s2;
      }
    }
  } else {
    for (i = 1; i <= s2; i++) {
      for (j = 1; j <= 26; j++) Temp[j] = a1[j];
      for (j = 0; j < strlen(c); j++) Temp[c[j] - 'a' + 1] -= i;
      s1 = 100050;
      for (k = 1; k <= 26; k++) {
        if (b1[k] == 0) continue;
        temp = Temp[k] / b1[k];
        s1 = s1 < temp ? s1 : temp;
      }
      if (s1 + i > sum) {
        sum = s1 + i;
        m = s1;
        n = i;
      }
    }
  }
  for (i = 1; i <= m; i++) cout << b;
  for (i = 0; i < strlen(b); i++) a1[b[i] - 'a' + 1] -= m;
  for (i = 1; i <= n; i++) cout << c;
  for (i = 0; i < strlen(c); i++) a1[c[i] - 'a' + 1] -= n;
  for (i = 1; i <= 26; i++) {
    for (j = 1; j <= a1[i]; j++) {
      cout << (char)(i + 'a' - 1);
    }
  }
  return 0;
}
