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 maxPossible(map<char, int> m1, map<char, int> m2) {
  double ans = 100000;
  map<char, int>::iterator it;
  for (it = m2.begin(); it != m2.end(); it++) {
    int a = it->second;
    char z = it->first;
    int b = m1[z];
    double num = (double)(b / a);
    if (num < ans) ans = num;
  }
  return (int)ans;
}
int maxotherpossible(map<char, int> m1, map<char, int> m2, map<char, int> m3,
                     int x) {
  map<char, int>::iterator it;
  for (it = m2.begin(); it != m2.end(); it++) {
    int a = it->second;
    char z = it->first;
    m1[z] = m1[z] - x * a;
  }
  int ans = maxPossible(m1, m3);
  return ans;
}
bool hasCharacters(map<char, int> m1, map<char, int> m2) {
  bool is = true;
  map<char, int>::iterator it;
  for (it = m2.begin(); it != m2.end(); it++) {
    int a = it->second;
    char z = it->first;
    if (m1[z] < a) {
      is = false;
    }
  }
  return is;
}
int main(int argc, const char* argv[]) {
  string a, b, c;
  cin >> a >> b >> c;
  int len1 = a.length();
  int len2 = b.length();
  int len3 = c.length();
  map<char, int> m1;
  map<char, int> m2;
  map<char, int> m3;
  for (int i = 0; i < len1; i++) {
    char z = a[i];
    m1[z]++;
  }
  for (int i = 0; i < len2; i++) {
    char z = b[i];
    m2[z]++;
  }
  for (int i = 0; i < len3; i++) {
    char z = c[i];
    m3[z]++;
  }
  bool is1 = hasCharacters(m1, m2);
  bool is2 = hasCharacters(m1, m3);
  string ans = "";
  int ans2, ans3;
  int x = maxPossible(m1, m2);
  int max = 0;
  for (int i = 0; i < x; i++) {
    int j = maxotherpossible(m1, m2, m3, i);
    int num = i + j;
    if (num > max) {
      max = num;
      ans2 = i;
      ans3 = j;
    }
  }
  for (int i = 0; i < ans2; i++) {
    ans.append(b);
  }
  for (int i = 0; i < ans3; i++) {
    ans.append(c);
  }
  map<char, int>::iterator it;
  for (it = m2.begin(); it != m2.end(); it++) {
    char z = it->first;
    m1[z] -= ans2;
  }
  for (it = m3.begin(); it != m3.end(); it++) {
    char z = it->first;
    m1[z] -= ans3;
  }
  for (it = m1.begin(); it != m1.end(); it++) {
    char z = it->first;
    for (int i = 0; i < m1[z]; i++) ans += z;
  }
  cout << ans;
  return 0;
}
