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 ch1[30], ch2[30], ch3[30];
  if (b > c) swap(b, c);
  memset(ch1, 0, sizeof ch1);
  memset(ch2, 0, sizeof ch2);
  memset(ch3, 0, sizeof ch3);
  int cnt1 = 0, cnt2 = 0, cnt3 = 0;
  for (int i = 0; i < a.size(); i++) ch1[a[i] - 'a']++;
  for (int j = 0; j < b.size(); j++) {
    ch2[b[j] - 'a']++;
    if (ch2[b[j] - 'a'] == 1) cnt2++;
  }
  for (int k = 0; k < c.size(); k++) {
    ch3[c[k] - 'a']++;
    if (ch3[c[k] - 'a'] == 1) cnt3++;
  }
  string A, B, C;
  A = a;
  B = b;
  C = c;
  string output;
  int num1 = 10000000;
  for (int i = 0; i < 26; i++) {
    if (ch2[i] != 0) {
      num1 = min(num1, ch1[i] / ch2[i]);
    }
  }
  int tot1 = 0;
  if (num1 != 10000000 && num1 != 0) {
    for (int i = 0; i < b.size(); i++) output += b[i], ch1[b[i] - 'a']--;
    tot1++;
    num1--;
    while (num1 != 0) {
      for (int i = 0; i < b.size(); i++) output += b[i], ch1[b[i] - 'a']--;
      num1--;
      tot1++;
    }
  }
  num1 = 1000000;
  for (int i = 0; i < 26; i++) {
    if (ch3[i] != 0) {
      num1 = min(num1, ch1[i] / ch3[i]);
    }
  }
  int tot2 = 0;
  if (num1 != 1000000 && num1 != 0) {
    for (int i = 0; i < c.size(); i++) output += c[i], ch1[c[i] - 'a']--;
    tot2++;
    num1--;
    while (num1 != 0) {
      for (int i = 0; i < b.size(); i++) output += c[i], ch1[c[i] - 'a']--;
      num1--;
      tot2++;
    }
  }
  for (int i = 1; i <= tot1; i++) {
    if (i == 1)
      cout << b;
    else if (cnt2 != 1)
      cout << b;
    else {
      for (int i = 0; i < 26; i++) {
        if (b[0] != i + 'a' && ch1[i] != 0) {
          cout << i + 'a';
          ch1[i]--;
          break;
        }
      }
      cout << b;
    }
  }
  for (int i = 1; i <= tot2; i++) {
    if (i == 1)
      cout << c;
    else if (cnt3 != 1)
      cout << c;
    else {
      for (int i = 0; i < 26; i++) {
        if (c[0] != i + 'a' && ch1[i] != 0) {
          cout << i + 'a';
          ch1[i]--;
          break;
        }
      }
      cout << c;
    }
  }
  for (int i = 0; i < 26; i++)
    if (ch1[i] != 0) {
      while (ch1[i]--) cout << char(i + 'a');
    }
}
