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;
const int mod = 1000000007;
const int INF = 0x7f7f7f7f;
int a[30], b[30], c[30], bc[30];
int main() {
  std::ios_base::sync_with_stdio(false);
  string aa, bb, cc;
  cin >> aa >> bb >> cc;
  for (int i = 0; aa[i]; i++) a[aa[i] - 'a']++;
  for (int i = 0; bb[i]; i++) b[bb[i] - 'a']++;
  for (int i = 0; cc[i]; i++) c[cc[i] - 'a']++;
  string bbcc = bb + cc;
  for (int i = 0; bbcc[i]; i++) bc[bbcc[i] - 'a']++;
  int xb, xc, xbc;
  xb = xc = xbc = 1000000;
  for (int i = 0; bb[i]; i++) xb = min(xb, a[bb[i] - 'a'] / b[bb[i] - 'a']);
  for (int i = 0; cc[i]; i++) xc = min(xc, a[cc[i] - 'a'] / c[cc[i] - 'a']);
  for (int i = 0; bbcc[i]; i++)
    xbc = min(xbc, a[bbcc[i] - 'a'] / bc[bbcc[i] - 'a']);
  int det;
  if (xb > xc and xb > xbc)
    det = 1;
  else if (xc > xbc)
    det = 2;
  else
    det = 3;
  if (det == 1) {
    while (xb--) {
      cout << bb;
      for (int i = 0; bb[i]; i++) a[bb[i] - 'a']--;
    }
    xc = 100000;
    for (int i = 0; cc[i]; i++) xc = min(xc, a[cc[i] - 'a'] / c[cc[i] - 'a']);
    while (xc--) {
      cout << cc;
      for (int i = 0; cc[i]; i++) a[cc[i] - 'a']--;
    }
    for (int i = 0; i < 26; i++)
      while (a[i]--) cout << (char)('a' + i);
  } else if (det == 2) {
    while (xc--) {
      cout << cc;
      for (int i = 0; cc[i]; i++) a[cc[i] - 'a']--;
    }
    xb = 1000000;
    for (int i = 0; bb[i]; i++) xb = min(xb, a[bb[i] - 'a'] / b[bb[i] - 'a']);
    while (xb--) {
      cout << bb;
      for (int i = 0; bb[i]; i++) a[bb[i] - 'a']--;
    }
    for (int i = 0; i < 26; i++)
      while (a[i]--) cout << (char)('a' + i);
  } else {
    while (xbc--) {
      cout << bbcc;
      for (int i = 0; bbcc[i]; i++) a[bbcc[i] - 'a']--;
    }
    xb = xc = 1000000;
    for (int i = 0; bb[i]; i++) xb = min(xb, a[bb[i] - 'a'] / b[bb[i] - 'a']);
    for (int i = 0; cc[i]; i++) xc = min(xc, a[cc[i] - 'a'] / c[cc[i] - 'a']);
    if (xb) {
      while (xb--) {
        cout << bb;
        for (int i = 0; bb[i]; i++) a[bb[i] - 'a']--;
      }
    } else {
      while (xc--) {
        cout << cc;
        for (int i = 0; cc[i]; i++) a[cc[i] - 'a']--;
      }
    }
    for (int i = 0; i < 26; i++)
      while (a[i]--) cout << (char)('a' + i);
  }
  cout << endl;
  return 0;
}
