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

//package codeforces;

import java.util.Scanner;

public class Codeforces {
    
    static int a[] = new int[100];
    static int b[] = new int[100];
    static int c[] = new int[100];
    
    public static void main(String[] args) {
        String astr, bstr, cstr;
        Scanner sc = new Scanner(System.in);
        
        astr = sc.next(); bstr = sc.next(); cstr = sc.next();
        
        for(int i = 0; i < astr.length(); ++i) a[astr.charAt(i) - 'a']++;
        for(int i = 0; i < bstr.length(); ++i) b[bstr.charAt(i) - 'a']++;
        for(int i = 0; i < cstr.length(); ++i) c[cstr.charAt(i) - 'a']++;
        
        
        int b_cnt = 0;
        
        int bNum = 0, cNum = 0;
        
        boolean exit = false;
        
        for(;;){
            int c_cnt = Integer.MAX_VALUE;
            
            for(int j = 0; j < 26; ++j){
                if(a[j] - b_cnt * b[j] < 0) { exit = true; break; }
                if(c[j] > 0) { c_cnt = Math.min(c_cnt, a[j] - b_cnt * b[j]) / c[j]; }
            }
            
            if(b_cnt + c_cnt > bNum + cNum) { bNum = b_cnt; cNum = c_cnt; }
            if(exit) break;
            b_cnt++;
        }
        
        
        for(int i = 0; i < 26; ++i){
            a[i] -= bNum * b[i] + cNum * c[i];
        }
        
        /*StringBuilder sb = new StringBuilder();
        for(int i = 0; i < b_cnt; ++i){
            sb.append(bstr);
        }
        for(int i = 0; i < c_cnt; ++i){
            sb.append(cstr);
        }
        
        for(int i = 0; i < 26; ++i){
            for(int j = 0; j < a[i]; ++j){
                sb.append((char)(i + 'a'));
            }
        }
        
        System.out.println(sb.toString());*/
        
        for(int i = 0; i < bNum; ++i){
            for(int j = 0; j < bstr.length(); ++j){
                System.out.printf("%c", bstr.charAt(j));
            }
        }
        for(int i = 0; i < cNum; ++i){
            for(int j = 0; j < cstr.length(); ++j){
                System.out.printf("%c", cstr.charAt(j));
            }
        }
        
        for(int i = 0; i < 26; ++i){
            for(int j = 0; j < a[i]; ++j){
                System.out.printf("%c", (char)(i + 'a'));
            }
        }
            
        sc.close();
    }
}
