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;
string a, b, c;
int occ1[26], occ2[26], occB[26], occC[26];
int main() {
  cin >> a >> b >> c;
  memset(occ1, 0, sizeof occ1);
  memset(occ2, 0, sizeof occ2);
  memset(occB, 0, sizeof occB);
  memset(occC, 0, sizeof occC);
  for (int i = 0; i < a.length(); i++) {
    occ1[a[i] - 'a']++;
    occ2[a[i] - 'a']++;
  }
  for (int i = 0; i < b.length(); i++) occB[b[i] - 'a']++;
  for (int i = 0; i < c.length(); i++) occC[c[i] - 'a']++;
  int ans1 = 0;
  string s1 = "";
  int mn = (int)1e9;
  for (int i = 0; i < 26; i++)
    if (occB[i] > 0) mn = min(mn, occ1[i] / occB[i]);
  for (int i = 0; i < mn; i++) {
    s1 += b;
    ans1++;
  }
  for (int i = 0; i < 26; i++) occ1[i] -= mn * occB[i];
  mn = (int)1e9;
  for (int i = 0; i < 26; i++)
    if (occC[i] > 0) mn = min(mn, occ1[i] / occC[i]);
  for (int i = 0; i < mn; i++) {
    s1 += c;
    ans1++;
  }
  for (int i = 0; i < 26; i++) occ1[i] -= mn * occC[i];
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < occ1[i]; j++) s1 += (i + 'a');
  int ans2 = 0;
  string s2 = "";
  mn = (int)1e9;
  for (int i = 0; i < 26; i++)
    if (occC[i] > 0) mn = min(mn, occ2[i] / occC[i]);
  for (int i = 0; i < mn; i++) {
    s2 += c;
    ans2++;
  }
  for (int i = 0; i < 26; i++) occ2[i] -= mn * occC[i];
  mn = (int)1e9;
  for (int i = 0; i < 26; i++)
    if (occB[i] > 0) mn = min(mn, occ2[i] / occB[i]);
  for (int i = 0; i < mn; i++) {
    s2 += b;
    ans2++;
  }
  for (int i = 0; i < 26; i++) occ2[i] -= mn * occB[i];
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < occ2[i]; j++) s2 += (i + 'a');
  if (ans1 > ans2)
    cout << s1 << '\n';
  else
    cout << s2 << '\n';
}
