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 s1;
  string s2;
  string s3;
  int ans = 0;
  cin >> s1;
  cin >> s2;
  cin >> s3;
  int arr[26];
  int a1[26];
  int a2[26];
  for (int i = 0; i < 26; i++) {
    arr[i] = 0;
    a1[i] = 0;
    a2[i] = 0;
  }
  for (int i = 0; i < s1.length(); i++) arr[s1[i] - 'a']++;
  for (int i = 0; i < s2.length(); i++) a1[s2[i] - 'a']++;
  for (int i = 0; i < s3.length(); i++) a2[s3[i] - 'a']++;
  if (s2.length() > s3.length()) {
    int min_val = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (a2[i] == 0) continue;
      if (a2[i] > arr[i]) {
        min_val = 0;
        break;
      } else
        min_val = min(min_val, arr[i] / a2[i]);
    }
    string ans = "";
    for (int i = 0; i < min_val; i++) ans += s3;
    for (int i = 0; i < 26; i++) {
      arr[i] -= (a2[i] * min_val);
    }
    min_val = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (a1[i] == 0) continue;
      if (a1[i] > arr[i]) {
        min_val = 0;
        break;
      } else
        min_val = min(min_val, arr[i] / a1[i]);
    }
    for (int i = 0; i < min_val; i++) ans += s2;
    for (int i = 0; i < 26; i++) {
      arr[i] -= (a1[i] * min_val);
    }
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < arr[i]; j++) ans += (i + 'a');
    }
    cout << ans << endl;
  } else {
    string ans = "";
    int min_val = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (a1[i] == 0) continue;
      if (a1[i] > arr[i]) {
        min_val = 0;
        break;
      } else
        min_val = min(min_val, arr[i] / a1[i]);
    }
    for (int i = 0; i < min_val; i++) ans += s2;
    for (int i = 0; i < 26; i++) {
      arr[i] -= (a1[i] * min_val);
    }
    min_val = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (a2[i] == 0) continue;
      if (a2[i] > arr[i]) {
        min_val = 0;
        break;
      } else
        min_val = min(min_val, arr[i] / a2[i]);
    }
    for (int i = 0; i < min_val; i++) ans += s3;
    for (int i = 0; i < 26; i++) {
      arr[i] -= (a2[i] * min_val);
    }
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < arr[i]; j++) ans += (i + 'a');
    }
    cout << ans << endl;
  }
}
