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 a[2010] = {0};
long long int b[2010] = {0};
int main() {
  string b, c, a;
  cin >> a;
  cin >> b;
  long long int i;
  cin >> c;
  long long int d[400] = {0};
  long long int e[400] = {0};
  long long int f[400] = {0};
  for (i = 0; i < a.size(); i++) {
    d[a[i]]++;
  }
  for (i = 0; i < b.size(); i++) {
    e[b[i]]++;
  }
  for (i = 0; i < c.size(); i++) {
    f[c[i]]++;
  }
  long long int ma1 = INT_MAX;
  for (i = 0; i < 300; i++) {
    if (e[i] > 0) {
      ma1 = min(ma1, d[i] / e[i]);
    }
  }
  long long int ma2 = INT_MAX;
  for (i = 0; i < 300; i++) {
    if (f[i] > 0) {
      ma2 = min(ma2, d[i] / f[i]);
    }
  }
  if (ma1 > ma2) {
    string s1;
    for (i = 0; i < ma1; i++) s1 = s1 + b;
    for (i = 0; i < 300; i++) d[i] = d[i] - (ma1 * e[i]);
    long long int rem = INT_MAX;
    for (i = 0; i <= 200; i++) {
      if (f[i] > 0) rem = min(rem, d[i] / f[i]);
    }
    for (i = 0; i < rem; i++) s1 = s1 + c;
    for (i = 0; i < 300; i++) d[i] = d[i] - (rem * f[i]);
    while (1) {
      for (i = 0; i < 300; i++) d[i] = d[i] + e[i];
      long long int rem = INT_MAX;
      for (i = 0; i <= 200; i++) {
        if (f[i] > 0) rem = min(rem, d[i] / f[i]);
      }
      if (rem > 1) {
        string s2;
        for (i = 0; i < s1.size() - b.size(); i++) {
          s2 = s2 + s1[i];
        }
        s1 = s2;
        for (i = 0; i < rem; i++) s1 = s1 + c;
        for (i = 0; i < 300; i++) d[i] = d[i] - (rem * f[i]);
      } else {
        for (i = 0; i < 300; i++) d[i] = d[i] - e[i];
        break;
      }
    }
    for (i = 0; i <= 200; i++) {
      while (d[i]--) {
        char ch = i;
        s1 = s1 + ch;
      }
    }
    cout << s1 << "\n";
  } else {
    string s1;
    for (i = 0; i < ma2; i++) s1 = s1 + c;
    for (i = 0; i < 300; i++) d[i] = d[i] - (ma2 * f[i]);
    long long int rem = INT_MAX;
    for (i = 0; i <= 200; i++) {
      if (e[i] > 0) rem = min(rem, d[i] / e[i]);
    }
    for (i = 0; i < rem; i++) s1 = s1 + b;
    for (i = 0; i < 300; i++) d[i] = d[i] - (rem * e[i]);
    while (1) {
      for (i = 0; i < 300; i++) d[i] = d[i] + f[i];
      long long int rem = INT_MAX;
      for (i = 0; i <= 200; i++) {
        if (e[i] > 0) rem = min(rem, d[i] / e[i]);
      }
      if (rem > 1) {
        string s2;
        for (i = 0; i < s1.size() - c.size(); i++) {
          s2 = s2 + s1[i];
        }
        s1 = s2;
        for (i = 0; i < rem; i++) s1 = s1 + b;
        for (i = 0; i < 300; i++) d[i] = d[i] - (rem * e[i]);
      } else {
        for (i = 0; i < 300; i++) d[i] = d[i] - f[i];
        break;
      }
    }
    for (i = 0; i <= 200; i++) {
      while (d[i]--) {
        char ch = i;
        s1 = s1 + ch;
      }
    }
    cout << s1 << "\n";
  }
}
