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;
const int mod = 1e9 + 7;
char s1[100005], s2[100005], s3[100005];
int len1, len2, len3;
int h1[30], h2[30], h3[30];
int cnt2, cnt3;
int main() {
  int i, j, k;
  while (~scanf("%s%s%s", s1, s2, s3)) {
    len1 = strlen(s1);
    len2 = strlen(s2);
    len3 = strlen(s3);
    memset(h1, 0, sizeof(h1));
    memset(h2, 0, sizeof(h2));
    memset(h3, 0, sizeof(h3));
    for (i = 0; i < len1; i++) h1[s1[i] - 'a']++;
    for (i = 0; i < len2; i++) h2[s2[i] - 'a']++;
    for (i = 0; i < len3; i++) h3[s3[i] - 'a']++;
    cnt2 = cnt3 = 0x3f3f3f3f;
    for (i = 0; i < 26; i++) {
      if (h1[i] && h2[i]) {
        cnt2 = min(cnt2, h1[i] / h2[i]);
      } else if (!h1[i] && h2[i]) {
        cnt2 = 0x3f3f3f3f;
        break;
      }
    }
    for (i = 0; i < 26; i++) {
      if (h1[i] && h3[i]) {
        cnt3 = min(cnt3, h1[i] / h3[i]);
      } else if (!h1[i] && h3[i]) {
        cnt3 = 0x3f3f3f3f;
        break;
      }
    }
    if (cnt2 == 0x3f3f3f3f && cnt3 == 0x3f3f3f3f) {
      printf("%s\n", s1);
      continue;
    }
    if (cnt2 == 0x3f3f3f3f && cnt3 != 0x3f3f3f3f) {
      for (i = 0; i < len3; i++) h1[s3[i] - 'a'] -= cnt3;
      while (cnt3--) {
        printf("%s", s3);
      }
      for (i = 0; i < 26; i++) {
        while (h1[i]--) printf("%c", i + 'a');
      }
      printf("\n");
      continue;
    }
    if (cnt2 != 0x3f3f3f3f && cnt3 == 0x3f3f3f3f) {
      for (i = 0; i < len2; i++) h1[s2[i] - 'a'] -= cnt2;
      while (cnt2--) {
        printf("%s", s2);
      }
      for (i = 0; i < 26; i++) {
        while (h1[i]--) printf("%c", i + 'a');
      }
      printf("\n");
      continue;
    }
    if (cnt2 >= cnt3) {
      for (i = 0; i < len2; i++) h1[s2[i] - 'a'] -= cnt2;
      while (cnt2--) {
        printf("%s", s2);
      }
      for (i = 0; i < 26; i++) {
        if (h1[i] && h3[i]) {
          cnt3 = min(cnt3, h1[i] / h3[i]);
        } else if (!h1[i] && h3[i]) {
          cnt3 = 0x3f3f3f3f;
          break;
        }
      }
      if (cnt3 != 0x3f3f3f3f) {
        for (i = 0; i < len3; i++) h1[s3[i] - 'a'] -= cnt3;
        while (cnt3--) {
          printf("%s", s3);
        }
      }
      for (i = 0; i < 26; i++) {
        while (h1[i]--) printf("%c", i + 'a');
      }
      printf("\n");
      continue;
    }
    for (i = 0; i < len3; i++) h1[s3[i] - 'a'] -= cnt3;
    while (cnt3--) {
      printf("%s", s3);
    }
    for (i = 0; i < 26; i++) {
      if (h1[i] && h2[i]) {
        cnt2 = min(cnt2, h1[i] / h2[i]);
      } else if (!h1[i] && h2[i]) {
        cnt2 = 0x3f3f3f3f;
        break;
      }
    }
    if (cnt2 != 0x3f3f3f3f) {
      for (i = 0; i < len2; i++) h1[s2[i] - 'a'] -= cnt2;
      while (cnt2--) {
        printf("%s", s2);
      }
    }
    for (i = 0; i < 26; i++) {
      while (h1[i]--) printf("%c", i + 'a');
    }
    printf("\n");
  }
  return 0;
}
