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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Map;

public class B {
    public static void main(String[] args) {
        String mainString,a,b;
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            mainString = br.readLine();
            a = br.readLine();
            b = br.readLine();
            br.close();
        } catch(IOException io) {
            io.printStackTrace();
            return;
        }

        Map<Character, Integer> mainCount = getCharsCount(mainString);
        Map<Character, Integer> aCount = getCharsCount(a);
        Map<Character, Integer> bCount = getCharsCount(b);

        int max = -1;
        int maxX = 0, maxY = 0;
        for (int x = 0; x <= mainString.length(); x++) {
            int y = fitAsManyB(mainCount, aCount, x, bCount);
            if (y < 0) continue;
            if (max < x + y) {
                max = x + y;
                maxX = x;
                maxY = y;
            }
        }

        // output stuff
        for (Map.Entry<Character, Integer> entry : aCount.entrySet()) {
            Character c = entry.getKey();
            Integer count = entry.getValue();
            if (count > 0) {
                Integer mainCharCount = mainCount.get(c);
                mainCount.put(c, mainCharCount - maxX * count);
            }
        }

        for (Map.Entry<Character, Integer> entry : bCount.entrySet()) {
            Character c = entry.getKey();
            Integer count = entry.getValue();
            if (count > 0) {
                Integer mainCharCount = mainCount.get(c);
                mainCount.put(c, mainCharCount - maxY * count);
            }
        }

        try {
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
            for (int i = 0; i < maxX; i++) {
                //System.out.print(a);
                bw.write(a);
            }
            for (int i = 0; i < maxY; i++) {
                //System.out.print(b);
                bw.write(b);
            }

            for (Map.Entry<Character, Integer> entry : mainCount.entrySet()) {
                Character c = entry.getKey();
                Integer count = entry.getValue();
                if (count > 0) {
                    for (int i = 0; i < count; i++) {
                        //System.out.print(c);
                        bw.write(c);
                    }
                }
            }
            
            bw.newLine();
        } catch (IOException e) {
            // ...
        }
    }

    private static final String alphabeth = "qwertyuiopasdfghjklzxcvbnm";

    private static Map<Character, Integer> getCharsCount(String s) {
        Map<Character, Integer> charMap = new HashMap<>();
        for (int i = 0; i < alphabeth.length(); i++) {
            charMap.put(alphabeth.charAt(i), 0);
        }

        for (int i = 0; i < s.length(); i++) {
            Character c = s.charAt(i);
            Integer count = charMap.get(c);
            charMap.put(c, count + 1);
        }

        return charMap;
    }

    // return -1 if not possible
    private static int fitAsManyB(Map<Character, Integer> source, Map<Character, Integer> a, int aCount, Map<Character, Integer> b) {
        int maxB = Integer.MAX_VALUE;
        for (Map.Entry<Character, Integer> entry : a.entrySet()) {
            Character c = entry.getKey();
            Integer countA = entry.getValue();
            Integer countB = b.get(c);
            Integer mainCount = source.get(c);

            if (mainCount < countA * aCount) {
                return -1;
            }

            if (countB > 0) {
                maxB = Math.min(maxB, (mainCount - countA * aCount) / countB);
            }
        }
        return maxB;
    }
}
