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 res1, res2, res3, res4, best1 = 0, best2 = 0, k;
int cnta[1000], cnt[1000], cntb[1000], cntc[1000];
string a, b, c;
int main() {
  getline(cin, a);
  getline(cin, b);
  getline(cin, c);
  for (int i = (0), _b = (300); i <= _b; i++) {
    cnta[i] = 0;
    cntb[i] = 0;
    cntc[i] = 0;
    cnt[i] = 0;
  }
  for (int i = (0), _b = (a.length() - 1); i <= _b; i++) {
    cnta[a[i]]++;
    cnt[a[i]]++;
  }
  for (int i = (0), _b = (b.length() - 1); i <= _b; i++) cntb[b[i]]++;
  for (int i = (0), _b = (c.length() - 1); i <= _b; i++) cntc[c[i]]++;
  res1 = 1000000000;
  for (int i = ('a'), _b = ('z'); i <= _b; i++)
    if (cntb[i] != 0) {
      k = cnta[i] / cntb[i];
      res1 = min(res1, k);
      cnta[i] -= k * cntb[i];
    }
  res2 = 1000000000;
  for (int i = ('a'), _b = ('z'); i <= _b; i++)
    if (cntc[i] != 0) {
      k = cnta[i] / cntc[i];
      res2 = min(res2, k);
      cnta[i] -= k * cntc[i];
    }
  if (res1 != 1000000000) best1 += res1;
  if (res2 != 1000000000) best1 += res2;
  for (int i = ('a'), _b = ('z'); i <= _b; i++) cnta[i] = cnt[i];
  res3 = 1000000000;
  for (int i = ('a'), _b = ('z'); i <= _b; i++)
    if (cntc[i] != 0) {
      k = cnta[i] / cntc[i];
      res3 = min(res3, k);
      cnta[i] -= k * cntc[i];
    }
  res4 = 1000000000;
  for (int i = ('a'), _b = ('z'); i <= _b; i++)
    if (cntb[i] != 0) {
      k = cnta[i] / cntb[i];
      res4 = min(res4, k);
      cnta[i] -= k * cntb[i];
    }
  if (res3 != 1000000000) best2 += res3;
  if (res4 != 1000000000) best2 += res4;
  if (best1 == 0 && best2 == 0)
    cout << a;
  else {
    if (best1 > best2) {
      for (int i = (1), _b = (res1); i <= _b; i++) {
        for (int j = (0), _b = (b.length() - 1); j <= _b; j++) {
          cout << b[j];
          cnt[b[j]]--;
        }
      }
      for (int i = (1), _b = (res2); i <= _b; i++) {
        for (int j = (0), _b = (c.length() - 1); j <= _b; j++) {
          cout << c[j];
          cnt[c[j]]--;
        }
      }
      for (int i = ('a'), _b = ('z'); i <= _b; i++)
        if (cnt[i] > 0) {
          for (int j = (1), _b = (cnt[i]); j <= _b; j++) printf("%c", i);
        }
    } else {
      for (int i = (1), _b = (res3); i <= _b; i++) {
        for (int j = (0), _b = (c.length() - 1); j <= _b; j++) {
          cout << c[j];
          cnt[c[j]]--;
        }
      }
      for (int i = (1), _b = (res4); i <= _b; i++) {
        for (int j = (0), _b = (b.length() - 1); j <= _b; j++) {
          cout << b[j];
          cnt[b[j]]--;
        }
      }
      for (int i = ('a'), _b = ('z'); i <= _b; i++)
        if (cnt[i] > 0) {
          for (int j = (1), _b = (cnt[i]); j <= _b; j++) printf("%c", i);
        }
    }
  }
}
