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>
int main() {
  char str_a[100001], str_b[100001], str_c[100001];
  int letter_a[26] = {0}, letter_b[26] = {0}, letter_c[26] = {0};
  ~scanf("%s\n%s\n%s", str_a, str_b, str_c);
  int len_a = strlen(str_a), len_b = strlen(str_b), len_c = strlen(str_c);
  for (int i = 0; i < len_a; i++) letter_a[str_a[i] - 'a']++;
  for (int i = 0; i < len_b; i++) letter_b[str_b[i] - 'a']++;
  for (int i = 0; i < len_c; i++) letter_c[str_c[i] - 'a']++;
  int max_num = 0, b_num = 0, c_num = 0;
  for (int i = 0; i <= 500; i++) {
    for (int j = 0; j <= 500; j++) {
      if (letter_b[0] * i + letter_c[0] * j <= letter_a[0] &&
          letter_b[1] * i + letter_c[1] * j <= letter_a[1] &&
          letter_b[2] * i + letter_c[2] * j <= letter_a[2] &&
          letter_b[3] * i + letter_c[3] * j <= letter_a[3] &&
          letter_b[4] * i + letter_c[4] * j <= letter_a[4] &&
          letter_b[5] * i + letter_c[5] * j <= letter_a[5] &&
          letter_b[6] * i + letter_c[6] * j <= letter_a[6] &&
          letter_b[7] * i + letter_c[7] * j <= letter_a[7] &&
          letter_b[8] * i + letter_c[8] * j <= letter_a[8] &&
          letter_b[9] * i + letter_c[9] * j <= letter_a[9] &&
          letter_b[10] * i + letter_c[10] * j <= letter_a[10] &&
          letter_b[11] * i + letter_c[11] * j <= letter_a[11] &&
          letter_b[12] * i + letter_c[12] * j <= letter_a[12] &&
          letter_b[13] * i + letter_c[13] * j <= letter_a[13] &&
          letter_b[14] * i + letter_c[14] * j <= letter_a[14] &&
          letter_b[15] * i + letter_c[15] * j <= letter_a[15] &&
          letter_b[16] * i + letter_c[16] * j <= letter_a[16] &&
          letter_b[17] * i + letter_c[17] * j <= letter_a[17] &&
          letter_b[18] * i + letter_c[18] * j <= letter_a[18] &&
          letter_b[19] * i + letter_c[19] * j <= letter_a[19] &&
          letter_b[20] * i + letter_c[20] * j <= letter_a[20] &&
          letter_b[21] * i + letter_c[21] * j <= letter_a[21] &&
          letter_b[22] * i + letter_c[22] * j <= letter_a[22] &&
          letter_b[23] * i + letter_c[23] * j <= letter_a[23] &&
          letter_b[24] * i + letter_c[24] * j <= letter_a[24] &&
          letter_b[25] * i + letter_c[25] * j <= letter_a[25]) {
        if (i + j > max_num) {
          max_num = i + j;
          b_num = i;
          c_num = j;
        }
      } else {
        break;
      }
    }
  }
  for (int i = 0; i < b_num; i++) printf("%s", str_b);
  for (int i = 0; i < c_num; i++) printf("%s", str_c);
  for (int i = 0; i < 26; i++) {
    letter_a[i] -= (letter_b[i] * b_num + letter_c[i] * c_num);
  }
  for (int i = 0; i < 26; i++)
    while (letter_a[i]--) printf("%c", 'a' + i);
  printf("\n");
}
