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;
const int maxn = 1e5 + 7;
const int INF = 1e9;
string a, b, c;
int c1[30], c2[30], c3[30];
int cnt1, cnt2;
void solve() {
  int len1 = a.length();
  for (int i = 0; i < len1; i++) {
    c1[a[i] - 'a']++;
  }
  int len2 = b.length();
  for (int i = 0; i < len2; i++) {
    c2[b[i] - 'a']++;
  }
  int len3 = c.length();
  for (int i = 0; i < len3; i++) {
    c3[c[i] - 'a']++;
  }
  cnt1 = cnt2 = INF;
  for (int i = 0; i < 26; i++) {
    if (c2[i]) cnt1 = min(cnt1, c1[i] / c2[i]);
    if (c3[i]) cnt2 = min(cnt2, c1[i] / c3[i]);
  }
  int t1 = INF, t2 = INF;
  for (int i = 0; i < 26; i++) {
    if (c3[i]) {
      t1 = min(t1, (c1[i] - cnt1 * c2[i]) / c3[i]);
    }
    if (c2[i]) {
      t2 = min(t2, (c1[i] - cnt2 * c3[i]) / c2[i]);
    }
  }
  if (t1 + cnt1 >= t2 + cnt2) {
    for (int i = 0; i < 26; i++) {
      if (c2[i]) {
        c1[i] -= cnt1 * c2[i];
      }
      if (c3[i]) cnt2 = min(cnt2, c1[i] / c3[i]);
    }
    for (int i = 0; i < 26; i++) {
      if (c3[i]) c1[i] -= cnt2 * c3[i];
    }
    for (int i = 0; i < cnt1; i++) cout << b;
    for (int i = 0; i < cnt2; i++) cout << c;
    for (int i = 0; i < 26; i++) {
      if (c1[i]) {
        for (int j = 0; j < c1[i]; j++) cout << char(i + 'a');
      }
    }
  } else {
    for (int i = 0; i < 26; i++) {
      if (c3[i]) {
        c1[i] -= cnt2 * c3[i];
      }
      if (c2[i]) cnt1 = min(cnt1, c1[i] / c2[i]);
    }
    for (int i = 0; i < 26; i++) {
      if (c2[i]) c1[i] -= cnt1 * c2[i];
    }
    for (int i = 0; i < cnt1; i++) cout << b;
    for (int i = 0; i < cnt2; i++) cout << c;
    for (int i = 0; i < 26; i++) {
      if (c1[i]) {
        for (int j = 0; j < c1[i]; j++) cout << char(i + 'a');
      }
    }
  }
  cout << endl;
}
int main() {
  cin >> a >> b >> c;
  solve();
}
