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

import java.util.Scanner;
public class main
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        String a = input.nextLine();
        String b = input.nextLine();
        String c = input.nextLine();
        
        int freq1[] = new int[200];
        int freq2[] = new int[200];
        int freq3[] = new int[200];

        char arr1[] = new char[a.length()];
        char arr2[] = new char[b.length()];
        char arr3[] = new char[c.length()];
        for(int i=0;i<a.length();i++)
        {
            freq1[a.charAt(i)]++;
            arr1[i] = a.charAt(i);
        }
        for(int i=0;i<b.length();i++)
                {
                        freq2[b.charAt(i)]++;
            arr2[i] = b.charAt(i);
                }
        for(int i=0;i<c.length();i++)
                {
                        freq3[c.charAt(i)]++;
            arr3[i] = c.charAt(i);
                }
        int count1[] = new int[200];
        int min1 = Integer.MAX_VALUE;
        for(int i=0;i<200;i++)
        {
            if(freq2[i]!=0)
            {
                count1[i] = freq1[i]/freq2[i];
                if(count1[i] < min1)
                {
                    min1 = count1[i];
                }
            }       
        }
        int count2[] = new int[200];
                int min2 = Integer.MAX_VALUE;
        for(int i=0;i<200;i++)
                {
                        if(freq3[i]!=0)
                        {
                                count2[i] = freq1[i]/freq3[i];
                                if(count2[i] < min2)
                                {
                                        min2 = count2[i];
                                }
                        }
                }
        char arr[] = new char[a.length()];
        int x = 0;
        if(min1 > min2)
        {
            int j = 0;
            for(int i=0;i<min1;i++)
            {
                for(int k=0;k<b.length();k++)
                {
                    arr[j++] = b.charAt(k);
                    freq1[b.charAt(k)]--;
                }
            }
            for(int i=0;i<200;i++)
            {
                if(freq1[i]!=0)
                {
                    while(freq1[i]!=0)
                    {
//                      System.out.println((char)i);
                        arr[j++] = (char)i;
                        freq1[i]--;
                    }
                }
//              arr[j++] = (char)freq1[i];
            }
        }
        else if(min2 > min1)
        {
            int j = 0;
                        for(int i=0;i<min2;i++)
                        {
                                for(int k=0;k<c.length();k++)
                                {
                                        arr[j++] = c.charAt(k);
                                        freq1[c.charAt(k)]--;
                                }
                        }
                        for(int i=0;i<200;i++)
                        {
                                if(freq1[i]!=0)
                                {
                                        while(freq1[i]!=0)
                                        {
//                                              System.out.println((char)i);
                                                arr[j++] = (char)i;
                                                freq1[i]--;
                                        }
                                }
//                              arr[j++] = (char)freq1[i];
                        }
        }
        else
        {
            x = 1;
            System.out.println(a);
        }
        if(x == 0)
        {
            for(int i=0;i<a.length();i++)
            {
                System.out.print(arr[i]);
            }
            System.out.println();
        }
    }
}