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 a, b, c, ans, ans1;
int arr[30], arr1[30], i, j, arr2[30], c1, c2;
int l1, l2, l3;
void f1() {
  bool f = true;
  j = 0;
  while (j < l1) {
    for (i = 0; i < 30; i++) {
      if (arr1[i] > arr[i]) {
        f = false;
        break;
      }
    }
    if (f && j + l2 <= l1) {
      ans += b;
      c1++;
      j += l2;
      for (i = 0; i < 30; i++) arr[i] = arr[i] - arr1[i];
    } else
      break;
  }
  f = true;
  while (j < l3) {
    for (i = 0; i < 30; i++) {
      if (arr2[i] > arr[i]) {
        f = false;
        break;
      }
    }
    if (f && j + l3 <= l1) {
      ans += c;
      c1++;
      j += l3;
      for (i = 0; i < 30; i++) arr[i] = arr[i] - arr2[i];
    } else
      break;
  }
  if (j < l1) {
    for (i = 0; i < 30; i++) {
      if (arr[i] > 0) {
        while (arr[i] > 0) {
          ans += (i + 'a');
          arr[i]--;
        }
      }
    }
  }
}
void f2() {
  bool f = true;
  j = 0;
  while (j < l3) {
    for (i = 0; i < 30; i++) {
      if (arr2[i] > arr[i]) {
        f = false;
        break;
      }
    }
    if (f && j + l3 <= l1) {
      ans1 += c;
      c2++;
      j += l3;
      for (i = 0; i < 30; i++) arr[i] = arr[i] - arr2[i];
    } else
      break;
  }
  while (j < l1) {
    for (i = 0; i < 30; i++) {
      if (arr1[i] > arr[i]) {
        f = false;
        break;
      }
    }
    if (f && j + l2 <= l1) {
      ans1 += b;
      c2++;
      j += l2;
      for (i = 0; i < 30; i++) arr[i] = arr[i] - arr1[i];
    } else
      break;
  }
  f = true;
  if (j < l1) {
    for (i = 0; i < 30; i++) {
      if (arr[i] > 0) {
        while (arr[i] > 0) {
          ans1 += (i + 'a');
          arr[i]--;
        }
      }
    }
  }
}
int main() {
  cin >> a;
  cin >> b;
  cin >> c;
  c1 = c2 = 0;
  l1 = a.size();
  l2 = b.size();
  l3 = c.size();
  for (i = 0; i < 30; i++) arr[i] = arr1[i] = arr2[i] = 0;
  for (i = 0; i < l1; i++) arr[a[i] - 'a']++;
  for (i = 0; i < l2; i++) arr1[b[i] - 'a']++;
  for (i = 0; i < l3; i++) arr2[c[i] - 'a']++;
  f1();
  for (i = 0; i < 30; i++) arr[i] = arr1[i] = arr2[i] = 0;
  for (i = 0; i < l1; i++) arr[a[i] - 'a']++;
  for (i = 0; i < l2; i++) arr1[b[i] - 'a']++;
  for (i = 0; i < l3; i++) arr2[c[i] - 'a']++;
  f2();
  if (c1 > c2)
    cout << ans << endl;
  else
    cout << ans1 << endl;
  return 0;
}
