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() {
  int64_t n = 0;
  std::string a;
  std::string b;
  std::string c;
  std::cin >> a >> b >> c;
  uint64_t map_a['z' - 'a' + 1] = {0};
  uint64_t map_b['z' - 'a' + 1] = {0};
  uint64_t map_c['z' - 'a' + 1] = {0};
  for (std::string::iterator it = a.begin(); it != a.end(); ++it) {
    map_a[*it - 'a']++;
  }
  for (std::string::iterator it = b.begin(); it != b.end(); ++it) {
    map_b[*it - 'a']++;
  }
  for (std::string::iterator it = c.begin(); it != c.end(); ++it) {
    map_c[*it - 'a']++;
  }
  char map[] = "abcdefghijklmnopqrstuvwxyz";
  uint64_t max_b = 100000;
  uint64_t max_c = 100000;
  for (uint64_t i = 0; i < 'z' - 'a' + 1; ++i) {
    if (map_a[i] < map_b[i] * max_b) {
      max_b = map_a[i] / map_b[i];
    }
    if (map_a[i] < map_c[i] * max_c) {
      max_c = map_a[i] / map_c[i];
    }
  }
  int64_t max = 0;
  int64_t f_max_b = 0;
  int64_t f_max_c = 0;
  for (uint64_t ib = 0; ib <= max_b; ++ib) {
    int64_t cur_max_c = 100000;
    for (uint64_t i = 0; i < 'z' - 'a' + 1; ++i) {
      if ((map_a[i] - ib * map_b[i]) < map_c[i] * cur_max_c) {
        cur_max_c = (map_a[i] - ib * map_b[i]) / map_c[i];
      }
    }
    if (cur_max_c + ib > max) {
      max = cur_max_c + ib;
      f_max_b = ib;
      f_max_c = cur_max_c;
    }
  }
  for (uint64_t ic = 0; ic <= max_c; ++ic) {
    int64_t cur_max_b = 100000;
    for (uint64_t i = 0; i < 'z' - 'a' + 1; ++i) {
      if ((map_a[i] - ic * map_c[i]) < map_b[i] * cur_max_b) {
        cur_max_b = (map_a[i] - ic * map_c[i]) / map_b[i];
      }
    }
    if (cur_max_b + ic > max) {
      max = cur_max_b + ic;
      f_max_b = cur_max_b;
      f_max_c = ic;
    }
  }
  if (f_max_b == 0 && f_max_c == 0) {
    std::cout << a;
  } else {
    for (uint64_t i = 0; i < f_max_b; ++i) {
      std::cout << b;
    }
    for (uint64_t i = 0; i < f_max_c; ++i) {
      std::cout << c;
    }
    for (uint64_t i = 0; i < 'z' - 'a' + 1; ++i) {
      uint64_t left = map_a[i] - f_max_b * map_b[i] - f_max_c * map_c[i];
      for (uint64_t j = 0; j < left; ++j) {
        std::cout << map[i];
      }
    }
  }
  std::cout << std::endl;
  return 0;
}
