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;
char a[100005], b[100005], c[100005];
vector<char> arr1, arr2, val;
map<char, int> mp1, mp2, mp3;
int main() {
  cin >> a;
  cin >> b;
  cin >> c;
  int len2 = strlen(b);
  for (int i = 0; i < len2; i++) {
    if (mp1.count(b[i]) == 0) {
      arr1.push_back(b[i]);
      mp1[b[i]] = 1;
    } else {
      mp1[b[i]]++;
    }
  }
  int len3 = strlen(c);
  for (int i = 0; i < len3; i++) {
    if (mp2.count(c[i]) == 0) {
      arr2.push_back(c[i]);
      mp2[c[i]] = 1;
    } else {
      mp2[c[i]]++;
    }
  }
  int len1 = strlen(a);
  for (int i = 0; i < len1; i++) {
    if (mp3.count(a[i]) == 0) {
      val.push_back(a[i]);
      mp3[a[i]] = 1;
    } else {
      mp3[a[i]]++;
    }
  }
  int temp1 = 123123;
  for (int i = 0; i < arr1.size(); i++) {
    int calc = mp3[arr1[i]] / mp1[arr1[i]];
    temp1 = min(temp1, calc);
  }
  int temp2 = 123123;
  for (int i = 0; i < arr2.size(); i++) {
    int calc = mp3[arr2[i]] / mp2[arr2[i]];
    temp2 = min(calc, temp2);
  }
  int sum = -123123;
  int bc = 0, mc = 0;
  for (int i = 0; i <= temp1; i++) {
    for (int j = 0; j < arr1.size(); j++) {
      mp3[arr1[j]] -= (i * mp1[arr1[j]]);
    }
    int temp3 = 123123;
    for (int j = 0; j < arr2.size(); j++) {
      int calc = mp3[arr2[j]] / mp2[arr2[j]];
      temp3 = min(calc, temp3);
    }
    for (int j = 0; j < arr1.size(); j++) {
      mp3[arr1[j]] += (i * mp1[arr1[j]]);
    }
    if (i + temp3 > sum) {
      bc = i;
      mc = temp3;
      sum = max(sum, i + temp3);
    }
  }
  for (int i = 0; i < bc; i++) {
    printf("%s", b);
  }
  for (int i = 0; i < mc; i++) {
    printf("%s", c);
  }
  for (int i = 0; i < arr1.size(); i++) {
    mp3[arr1[i]] -= (bc * mp1[arr1[i]]);
  }
  for (int i = 0; i < arr2.size(); i++) {
    mp3[arr2[i]] -= (mc * mp2[arr2[i]]);
  }
  for (int i = 0; i < val.size(); i++) {
    for (int j = 0; j < mp3[val[i]]; j++) {
      printf("%c", val[i]);
    }
  }
  return 0;
}
