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;
int main() {
  string A, B, C;
  cin >> A >> B >> C;
  int a[27] = {0}, b[27] = {0}, c[27] = {0}, i, j = 0, k = 0, cnt = 0,
      max1 = 100003, max2 = 100003, flag = 0;
  for (i = 0; i < A.length(); i++) a[A[i] - 'a']++;
  for (i = 0; i < B.length(); i++) b[B[i] - 'a']++;
  for (i = 0; i < C.length(); i++) c[C[i] - 'a']++;
  for (i = 0; i < 27; i++) {
    if (b[i] != 0) j++;
  }
  for (i = 0; i < 27; i++) {
    if (b[i] != 0) k++;
  }
  for (i = 0; i < 27; i++) {
    if (a[i] != 0 && b[i] != 0) {
      cnt++;
      int x;
      x = a[i] / b[i];
      if (x < max1) max1 = x;
    }
  }
  if (j == cnt) flag = 1;
  cnt = 0;
  for (i = 0; i < 27; i++) {
    if (a[i] != 0 && c[i] != 0) {
      cnt++;
      int x;
      x = a[i] / c[i];
      if (x < max2) max2 = x;
    }
  }
  if (k == cnt && flag == 0)
    flag = 2;
  else if (k == cnt && flag == 1)
    flag = 3;
  if (flag == 1) {
    while (max1--) {
      for (i = 0; i < B.length(); i++) {
        cout << B[i];
        a[B[i] - 'a']--;
      }
    }
    for (i = 0; i < 27; i++) {
      if (a[i] != 0 && c[i] == 0) {
        cout << char(i + 'a');
        a[A[i] - 'a']--;
        break;
      }
    }
    for (i = 0; i < 27; i++) {
      while (a[i]--) {
        cout << (char)(i + 'a');
      }
    }
  } else if (flag == 2) {
    while (max2--) {
      for (i = 0; i < C.length(); i++) {
        cout << C[i];
        a[C[i] - 'a']--;
      }
    }
    for (i = 0; i < 27; i++) {
      if (a[i] != 0 && b[i] == 0) {
        cout << char(i + 'a');
        a[A[i] - 'a']--;
        break;
      }
    }
    for (i = 0; i < 27; i++) {
      while (a[i]--) {
        cout << (char)(i + 'a');
      }
    }
  } else if (flag == 3) {
    if (max1 > max2) {
      while (max1--) {
        for (i = 0; i < B.length(); i++) {
          cout << B[i];
          a[B[i] - 'a']--;
        }
      }
      cnt = 0;
      for (i = 0; i < 27; i++) {
        if (a[i] != 0 && c[i] != 0) {
          cnt++;
          int x;
          x = a[i] / c[i];
          if (x < max2) max2 = x;
        }
      }
      if (k == cnt) {
        while (max2--) {
          for (i = 0; i < C.length(); i++) {
            cout << C[i];
            a[C[i] - 'a']--;
          }
        }
      }
      for (i = 0; i < 27; i++) {
        if (a[i] != 0 && c[i] == 0) {
          cout << char(i + 'a');
          a[A[i] - 'a']--;
          break;
        }
      }
      for (i = 0; i < 27; i++) {
        while (a[i]--) cout << (char)(i + 'a');
      }
    } else {
      while (max2--) {
        for (i = 0; i < C.length(); i++) {
          cout << C[i];
          a[C[i] - 'a']--;
        }
      }
      cnt = 0;
      for (i = 0; i < 27; i++) {
        if (a[i] != 0 && b[i] != 0) {
          cnt++;
          int x;
          x = a[i] / b[i];
          if (x < max1) max2 = x;
        }
      }
      if (j == cnt) {
        while (max1--) {
          for (i = 0; i < B.length(); i++) {
            cout << B[i];
            a[B[i] - 'a']--;
          }
        }
      }
      for (i = 0; i < 27; i++) {
        if (a[i] != 0 && b[i] == 0) {
          cout << char(i + 'a');
          a[A[i] - 'a']--;
          break;
        }
      }
      for (i = 0; i < 27; i++) {
        while (a[i]--) cout << (char)(i + 'a');
      }
    }
  }
  return 0;
}
