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>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
int main() {
  long long n, i, j;
  long long cnta[26], cntb[26], cntc[26];
  string a, b, c;
  cin >> a >> b >> c;
  int sza = a.size(), szb = b.size(), szc = c.size();
  memset(cnta, 0, sizeof(cnta));
  memset(cntb, 0, sizeof(cntb));
  memset(cntc, 0, sizeof(cntc));
  for (j = 0; j < szb; j++) {
    cntb[b[j] - 'a']++;
  }
  for (j = 0; j < sza; j++) {
    cnta[a[j] - 'a']++;
  }
  for (j = 0; j < szc; j++) {
    cntc[c[j] - 'a']++;
  }
  long long min1 = 100001, min2 = 100001, canb = 0, canc = 0;
  for (j = 0; j < 26; j++)
    if (cntb[j]) {
      if (cnta[j] < cntb[j])
        canb = -1;
      else {
        min1 = min(min1, cnta[j] / cntb[j]);
      }
    }
  if (min1 == 100001) min1 = 0;
  for (j = 0; j < 26; j++)
    if (cntc[j]) {
      if (cnta[j] < cntc[j])
        canc = -1;
      else {
        min2 = min(min2, cnta[j] / cntc[j]);
      }
    }
  if (min2 == 100001) min2 = 0;
  if (canc && !canb) {
    string ans;
    for (j = 0; j < 26; j++) cnta[j] -= (min1 * cntb[j]);
    i = min1;
    while (i--) ans += b;
    for (j = 0; j < 26; j++) {
      i = cnta[j];
      while (i > 0) {
        ans += ('a' + j);
        i--;
      }
    }
    cout << ans;
  } else if (!canc && canb) {
    string ans;
    for (j = 0; j < 26; j++) cnta[j] -= (min2 * cntc[j]);
    i = min2;
    while (i--) ans += c;
    for (j = 0; j < 26; j++) {
      i = cnta[j];
      while (i > 0) {
        ans += ('a' + j);
        i--;
      }
    }
    cout << ans;
  } else {
    long long tot = 0, t1 = 0, t2 = 0;
    for (i = 0; i <= max(min1, min2); i++) {
      long long dum[26], poss = 0;
      memset(dum, 0, sizeof(dum));
      for (j = 0; j < 26; j++) {
        dum[j] = cnta[j] - i * cntb[j];
      }
      long long k1 = 100001;
      for (j = 0; j < 26; j++) {
        if (cntc[j]) {
          if (dum[j] >= cntc[j]) {
            k1 = min(k1, dum[j] / cntc[j]);
          } else
            poss = -1;
        }
      }
      if (k1 == 100001) k1 = 0;
      if (i + k1 > tot && !poss) {
        t1 = i;
        t2 = k1;
        tot = i + k1;
      }
    }
    for (i = 0; i <= max(min1, min2); i++) {
      long long dum[26], poss = 0;
      memset(dum, 0, sizeof(dum));
      for (j = 0; j < 26; j++) {
        dum[j] = cnta[j] - i * cntc[j];
      }
      long long k1 = 100001;
      for (j = 0; j < 26; j++) {
        if (cntb[j]) {
          if (dum[j] >= cntb[j]) {
            k1 = min(k1, dum[j] / cntb[j]);
          } else
            poss = -1;
        }
      }
      if (k1 == 100001) k1 = 0;
      if (i + k1 > tot && !poss) {
        t1 = k1;
        t2 = i;
        tot = i + k1;
      }
    }
    for (j = 0; j < 26; j++) cnta[j] -= (t1 * cntb[j] + t2 * cntc[j]);
    i = t1;
    string ans;
    while (i--) ans += b;
    i = t2;
    while (i--) ans += c;
    for (j = 0; j < 26; j++) {
      i = cnta[j];
      while (i > 0) {
        ans += ('a' + j);
        i--;
      }
    }
    cout << ans;
  }
  return 0;
}
