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 main() {
  string A, B, C;
  cin >> A >> B >> C;
  int arrayA[26];
  int arrayB[26];
  int arrayC[26];
  memset(arrayA, 0, sizeof(arrayA));
  memset(arrayB, 0, sizeof(arrayB));
  memset(arrayC, 0, sizeof(arrayC));
  for (int i = 0; i < A.length(); i++) {
    arrayA[(A[i] - 'a')]++;
  }
  for (int i = 0; i < B.length(); i++) {
    arrayB[(B[i] - 'a')]++;
  }
  for (int i = 0; i < C.length(); i++) {
    arrayC[(C[i] - 'a')]++;
  }
  int minB = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (arrayB[i]) {
      minB = arrayA[i] / arrayB[i] < minB ? arrayA[i] / arrayB[i] : minB;
    }
  }
  int minC = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (arrayC[i]) {
      minC = arrayA[i] / arrayC[i] < minC ? arrayA[i] / arrayC[i] : minC;
    }
  }
  int remainC = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (arrayC[i]) {
      remainC = (arrayA[i] - arrayB[i] * minB) / arrayC[i] < remainC
                    ? (arrayA[i] - arrayB[i] * minB) / arrayC[i]
                    : remainC;
    }
  }
  int remainB = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (arrayB[i]) {
      remainB = (arrayA[i] - arrayC[i] * minC) / arrayB[i] < remainB
                    ? (arrayA[i] - arrayC[i] * minC) / arrayB[i]
                    : remainB;
    }
  }
  string s;
  int max = 0;
  int bestB = 0;
  for (int x = 0; x <= minB; x++) {
    int temp = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (arrayC[i]) {
        temp = (arrayA[i] - arrayB[i] * x) / arrayC[i] < temp
                   ? (arrayA[i] - arrayB[i] * x) / arrayC[i]
                   : temp;
      }
    }
    if (x + temp > max) {
      max = x + temp;
      bestB = x;
    }
  }
  for (int i = 0; i < bestB; i++) {
    s = s + B;
  }
  for (int i = 0; i < max - bestB; i++) {
    s = s + C;
  }
  for (int i = 0; i < 26; i++) {
    arrayA[i] = arrayA[i] - (arrayB[i] * bestB) - (arrayC[i] * (max - bestB));
  }
  char c;
  for (int i = 0; i < 26; i++) {
    while (arrayA[i]--) {
      c = 'a' + i;
      s = s + c;
    }
  }
  cout << s;
  return 0;
}
