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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * nisteaadddiiklooprrvz
 * nisteaaddiikloprrv
 * 
 * ´3`
 * */
public class C_Div2_307 {
    public static void main(String[]arg) throws IOException
    {
        new C_Div2_307().solve();
    }
    public void solve() throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String a = in.readLine();
        String b = in.readLine();
        String c = in.readLine();
        int[]nums = new int[26];
        int[]nb = new int[26];
        int[]nc = new int[26];
        int i,j;
        char car = 'a';
        for(i = 0; i < a.length(); i++)
        {
            car = a.charAt(i);
            nums[car-'a']++;
        }
        for(i = 0; i < b.length(); i++)
        {
            car = b.charAt(i);
            nb[car-'a']++;
        }
        for(i = 0; i < c.length(); i++)
        {
            car = c.charAt(i);
            nc[car-'a']++;
        }
        boolean is = true;
        int cb = 0;
        int[]cnum = nums.clone();
        while(is)
        {
            for(i = 0; i < 26 && is; i++)
            {
                if(cnum[i] >= nb[i])
                {
                    cnum[i] -= nb[i];
                }
                else
                    is = false;
            }
            if(is)
                cb++;
        }
        is = true;
        int cc = 0;
        cnum = nums.clone();
        while(is)
        {
            
            for(i = 0; i < 26 && is; i++)
            {
                if(cnum[i] >= nc[i])
                {
                    cnum[i] -= nc[i];
                }
                else
                    is = false;
            }
            if(is)
                cc++;           
        }
        String ans = "";
        if(cb >= cc)
        {
            //System.out.println("B");
            for(i = 0; i < cb; i++)
            {
                ans += b;
                for(j = 0; j < 26; j++)
                {
                    nums[j] -= nb[j];
                }
            }
            //System.out.println("in");
            is = true;
            while(is)
            {
                for(i = 0; i < 26 && is; i++)
                {
                    if(nums[i] >= nc[i])
                    {
                        nums[i] -= nc[i];
                    }
                    else
                        is = false;
                }
                if(is)
                {
                    ans +=  c;
                }
                else
                    for(i = 0; i < 26 && is; i++)
                    {
                        if(nums[i] >= nc[i])
                        {
                            nums[i] += nc[i];
                        }
                    }
            }
            for(car = 'a'; car <= 'z'; car++)
            {
                if(nums[car-'a'] >0)
                {
                    while(nums[car-'a'] >0)
                    {
                        ans += car;
                        nums[car-'a']--;
                    }
                }
            }
        }
        else
        {
            //System.out.println("A");
            for(i = 0; i < cc; i++)
            {
                ans += c;
                for(j = 0; j < 26; j++)
                {
                    nums[j] -= nc[j];
                }
            }
            is = true;
            while(is)
            {
                for(i = 0; i < 26 && is; i++)
                {
                    if(nums[i] >= nb[i])
                    {
                        nums[i] -= nb[i];
                    }
                    else
                        is = false;
                }
                if(is)
                {
                    ans +=  c;
                }
                else
                    for(i = 0; i < 26 && is; i++)
                    {
                        if(nums[i] >= nb[i])
                        {
                            nums[i] += nb[i];
                        }
                    }
            }
            for(car = 'a'; car <= 'z'; car++)
            {
                if(nums[car-'a'] >0)
                {
                    while(nums[car-'a'] >0)
                    {
                        ans += car;
                        nums[car-'a']--;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}