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;
string k = "";
string X, Y, Z;
int a[26], b[26], c[26];
bool esta_b(void) {
  for (int i = 0; i < 26; i++) {
    if (b[i] > a[i]) return false;
  }
  return true;
}
void borrar_b(void) {
  for (int i = 0; i < 26; i++) {
    a[i] -= b[i];
  }
}
bool esta_c(void) {
  for (int i = 0; i < 26; i++) {
    if (c[i] > a[i]) return false;
  }
  return true;
}
void borrar_c(void) {
  for (int i = 0; i < 26; i++) {
    a[i] -= c[i];
  }
}
int times_b(void) {
  if (!esta_b()) return 0;
  int times = 0;
  int minn = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (b[i] == 0) continue;
    times = a[i] / b[i];
    minn = min(times, minn);
  }
  return minn;
}
int times_c(void) {
  if (!esta_b()) return 0;
  int times = 0;
  int minn = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (c[i] == 0) continue;
    times = a[i] / c[i];
    minn = min(times, minn);
  }
  return minn;
}
void insertremainder(void) {
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < a[i]; j++) {
      k = k + (char)(i + 'a');
    }
  }
}
void start() {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  memset(c, 0, sizeof(c));
  cin >> X;
  for (int i = 0; i < X.size(); i++) {
    a[X.at(i) - 'a']++;
  }
  cin >> Y;
  for (int i = 0; i < Y.size(); i++) {
    b[Y.at(i) - 'a']++;
  }
  cin >> Z;
  for (int i = 0; i < Z.size(); i++) {
    c[Z.at(i) - 'a']++;
  }
  int tb = times_b(), tc = times_c();
  if (tb == 0 && tc == 0) {
    cout << X << '\n';
    return;
  }
  if ((tb > tc && Y.size() < Z.size()) || (tc > tb && Y.size() < Z.size())) {
    for (int i = 0; i < tb; i++) {
      k = k + Y;
      borrar_b();
    }
    while (esta_c()) {
      k = k + Z;
      borrar_c();
    }
  } else if ((tb > tc && Y.size() > Z.size()) ||
             (tc > tb && Z.size() < Y.size())) {
    for (int i = 0; i < tc; i++) {
      k = k + Z;
      borrar_c();
    }
    while (esta_b()) {
      k = k + Y;
      borrar_b();
    }
  }
  insertremainder();
  cout << k << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  start();
  return 0;
}
