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.Arrays;
import java.util.StringTokenizer;

/**
 * nisteaadddiiklooprrvz
 * nisteaaddiikloprrv
 * 
 * ´3`
 * */
public class B_Div2_307{
    public static void main(String[]arg) throws IOException
    {
        new B_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']++;
        }        
        
        int[]numc = nums.clone();
        int[]numb = nums.clone();
        
        int cc = Integer.MAX_VALUE;
        int cb = Integer.MAX_VALUE;
        //System.out.println(Arrays.toString(nums));
        //System.out.println(Arrays.toString(nb));
        //System.out.println(Arrays.toString(nc));
        for(i = 0; i < 26; i++)
        {
            if(nb[i] != 0)
            {
                cb = Math.min(cb, numb[i]/nb[i]);
            }
            if(nc[i] != 0)
            {
                cc = Math.min(cc, numc[i]/nc[i]);
            }
        }
        //System.out.println(cb + "  " + cc);
        StringBuffer ans = new StringBuffer();
        if(cc == cb && cc == 0)
            ans.append(a);
        else if(cc >= cb)
        {
            for(i = 0; i < cc; i++)
            {
                ans.append(c);
            }
            for(i = 0; i < 26; i++)
            {
                nums[i] -= cc*nc[i];
            }
            cb = Integer.MAX_VALUE;
            for(i = 0; i < 26; i++)
            {
                if(nb[i] != 0)
                {
                    cb = Math.min(cb, nums[i]/nb[i]);
                }
            }
            for(i = 0; i < cb; i++)
            {
                ans.append(b);
            }
            for(i = 0; i < 26; i++)
            {
                nums[i] -= cb*nb[i];
            }
            car = 'a';
            for(i = 0; i < 26; car++, i++)
            {
                while(nums[i] > 0)
                {
                    ans.append(car);
                    nums[i]--;
                }
            }
        }
        else
        {
            for(i = 0; i < cb; i++)
            {
                ans.append(b);
            }
            for(i = 0; i < 26; i++)
            {
                nums[i] -= cb*nb[i];
            }
            cc = Integer.MAX_VALUE;
            for(i = 0; i < 26; i++)
            {
                if(nc[i] != 0)
                {
                    cc = Math.min(cc, nums[i]/nc[i]);
                }
            }
            for(i = 0; i < cc; i++)
            {
                ans.append(c);
            }
            for(i = 0; i < 26; i++)
            {
                nums[i] -= cc*nc[i];
            }
            car = 'a';
            for(i = 0; i < 26; car++, i++)
            {
                while(nums[i] > 0)
                {
                    ans.append(car);
                    nums[i]--;
                }
            }
        }
        if(ans.length() == a.length())
            System.out.println(ans);
        else
            System.out.println(a);
    }
}