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;
long long int gcd(long long int m, long long int n) {
  if (n == 0) return m;
  return gcd(n, m % n);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string a, b, c;
  cin >> a;
  cin >> b;
  cin >> c;
  int arr[26] = {0};
  int barr[26] = {0};
  int carr[26] = {0};
  for (int i = 0; i < (int)(a.size()); i++) arr[a[i] - 'a']++;
  for (int i = 0; i < (int)(b.size()); i++) barr[b[i] - 'a']++;
  for (int i = 0; i < (int)(c.size()); i++) carr[c[i] - 'a']++;
  char f[100010];
  int k = 0;
  while (1) {
    int fl1 = 0;
    int fl2 = 0;
    int bmin = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (arr[i] < barr[i]) {
        fl1 = 1;
        break;
      }
      if (arr[i] != 0 && barr[i] != 0) {
        bmin = min(bmin, arr[i] / barr[i]);
      }
    }
    int cmin = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (arr[i] < carr[i]) {
        fl2 = 1;
        break;
      }
      if (arr[i] != 0 && carr[i] != 0) {
        cmin = min(cmin, arr[i] / carr[i]);
      }
    }
    if (fl1 == 1 && fl2 == 1)
      break;
    else if (fl1 == 1) {
      for (int j = 0; j < (int)(c.size()); j++) {
        f[k] = c[j];
        k++;
        arr[c[j] - 'a']--;
      }
    } else if (fl2 == 1) {
      for (int j = 0; j < (int)(b.size()); j++) {
        f[k] = b[j];
        k++;
        arr[b[j] - 'a']--;
      }
    } else {
      if (cmin >= bmin) {
        for (int j = 0; j < (int)(c.size()); j++) {
          f[k] = c[j];
          k++;
          arr[c[j] - 'a']--;
        }
      } else {
        for (int j = 0; j < (int)(b.size()); j++) {
          f[k] = b[j];
          k++;
          arr[b[j] - 'a']--;
        }
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    while (arr[i] > 0) {
      f[k] = 97 + i;
      k++;
      arr[i]--;
    }
  }
  for (int i = 0; i < (int)(a.size()); i++) cout << f[i];
  cout << endl;
  return 0;
}
