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 com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author Sergey
 */
public final class B_ZgukistringZ {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String a = in.nextLine();
        String b = in.nextLine();
        String c= in.nextLine();
        Map<Character, Integer> aCount = countChars(a);
        Map<Character, Integer> bCount = countChars(b);
        Map<Character, Integer> cCount = countChars(c);

        int wordB = howMuchWords(aCount, bCount);
        int wordC = howMuchWords(aCount, cCount);

        if (wordB == 0 && wordC == 0) {
            System.out.println(a);
            return;
        } else if (b.equals(c)) {
            StringBuilder answer = new StringBuilder();
            for (int i = 0; i < wordB; i++) {
                answer.append(b);
            }
            System.out.println(answer);
            return;
        }

        final Map<Character, Integer> gtMap;
        final Map<Character, Integer> loMap;
        final String gt;
        final String lo;
        final int repGt;
        if (wordB > wordC) {
            gtMap = bCount;
            loMap = cCount;
            repGt = wordB;
            gt = b;
            lo = c;
        } else {
            gtMap = cCount;
            loMap = bCount;
            repGt = wordC;
            gt = c;
            lo = b;
        }

        subtractMap(aCount, gtMap, repGt);
        final int repLo = howMuchWords(aCount, loMap);
        if (repLo > 0) {
            subtractMap(aCount, loMap, repLo);
        }
        StringBuilder answer = new StringBuilder();
        for (int i = 0; i < repGt; i++) {
            answer.append(gt);
        }
        for (int i = 0; i < repLo; i++) {
            answer.append(lo);
        }
        for (Map.Entry<Character, Integer> entry : aCount.entrySet()) {
            for (int i = 0; i < entry.getValue(); i++) {
                answer.append(entry.getKey());
            }
        }
        System.out.println(answer);
    }

    private static void subtractMap(Map<Character, Integer> from, Map<Character, Integer> which, int repWhich) {
        for (Map.Entry<Character, Integer> entry : which.entrySet()) {
            int oldValue = from.get(entry.getKey());
            int subtract = entry.getValue() * repWhich;
            from.put(entry.getKey(), oldValue - subtract);
        }
    }

    private static int howMuchWords(Map<Character, Integer> sup, Map<Character, Integer> words) {
        int min = Integer.MAX_VALUE;
        for (Character c : words.keySet()) {
            int forThisChar = sup.getOrDefault(c, 0) / words.get(c);
            min = Math.min(min, forThisChar);
        }
        return min;
    }

    private static Map<Character, Integer> countChars(String s) {
        Map<Character, Integer> countMap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            int oldValue = countMap.getOrDefault(s.charAt(i), 0);
            countMap.put(s.charAt(i), oldValue + 1);
        }
        return countMap;
    }
}
