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>
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
using namespace std;
char cha[maxn];
char chb[maxn];
char chc[maxn];
int a[30];
int b[30];
int c[30];
int main() {
  int ans1 = INF, ans2 = INF;
  cin >> cha;
  int lena = strlen(cha);
  for (int i = 0; i < lena; i++) {
    a[cha[i] - 'a']++;
  }
  cin >> chb;
  int lenb = strlen(chb);
  for (int i = 0; i < lenb; i++) {
    b[chb[i] - 'a']++;
  }
  cin >> chc;
  int lenc = strlen(chc);
  for (int i = 0; i < lenc; i++) {
    c[chc[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (b[i] != 0) {
      ans1 = min(ans1, a[i] / b[i]);
    }
  }
  for (int i = 0; i < 26; i++) {
    if (c[i] != 0) {
      ans2 = min(ans2, a[i] / c[i]);
    }
  }
  if (ans1 < ans2) {
    for (int i = 0; i < ans2; i++) {
      cout << chc;
    }
    for (int i = 0; i < 26; i++) {
      a[i] -= ans2 * c[i];
    }
    for (int i = 0; i < 26; i++) {
      if (b[i] != 0) {
        ans1 = min(ans1, a[i] / b[i]);
      }
    }
    for (int i = 0; i < ans1; i++) {
      cout << chb;
    }
    for (int i = 0; i < 26; i++) {
      a[i] -= ans1 * b[i];
    }
    for (int i = 0; i < 26; i++) {
      while (a[i] != 0) {
        a[i]--;
        printf("%c", 'a' + i);
      }
    }
  } else {
    for (int i = 0; i < ans1; i++) {
      cout << chb;
    }
    for (int i = 0; i < 26; i++) {
      a[i] -= ans1 * b[i];
    }
    for (int i = 0; i < 26; i++) {
      if (c[i] != 0) {
        ans2 = min(ans2, a[i] / c[i]);
      }
    }
    for (int i = 0; i < ans2; i++) {
      cout << chc;
    }
    for (int i = 0; i < 26; i++) {
      a[i] -= ans2 * c[i];
    }
    for (int i = 0; i < 26; i++) {
      while (a[i] != 0) {
        a[i]--;
        printf("%c", 'a' + i);
      }
    }
  }
  return 0;
}
