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;

public class Y {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        String a = scanner.next();
        String b = scanner.next();
        String c = scanner.next();
        int[] freqA = new int[26];
        for (int i = 0; i < a.length(); i++) {
            freqA[a.charAt(i) - 'a']++;
        }
        int[] freqB = new int[26];
        for (int i = 0; i < b.length(); i++) {
            freqB[b.charAt(i) - 'a']++;
        }
        int[] freqC = new int[26];
        for (int i = 0; i < c.length(); i++) {
            freqC[c.charAt(i) - 'a']++;
        }
        int maxB = Integer.MAX_VALUE;
        for (int i = 0; i < 26; i++) {
            if (freqB[i] != 0)
                maxB = Math.min(maxB, freqA[i] / freqB[i]);
        }
        int maxC = Integer.MAX_VALUE;
        for (int i = 0; i < 26; i++) {
            if (freqC[i] != 0)
                maxC = Math.min(maxC, freqA[i] / freqC[i]);
        }
        StringBuilder out1 = new StringBuilder();
        int[] aCopy1 = Arrays.copyOf(freqA, 26);
        int c1 = firstB(b, c, aCopy1, freqB, freqC, maxB, out1);
        StringBuilder out2 = new StringBuilder();
        int[] aCopy2 = Arrays.copyOf(freqA, 26);
        int c2 = firstC(b, c, aCopy2, freqB, freqC, maxC, out2);
        if (c1 > c2) {
            for (int i = 0; i < 26; i++) {
                for (int j = 0; j < aCopy1[i]; j++) {
                    char x = ((char) (i + 'a'));
                    out1.append(x);
                }

            }
            System.out.println(out1);
        } else  {
            for (int i = 0; i < 26; i++) {
                for (int j = 0; j < aCopy2[i]; j++) {
                    char x = ((char) (i + 'a'));
                    out2.append(x);
                }

            }
            System.out.println(out2);
        }

    }

    private static int firstB(String b, String c, int[] freqA, int[] freqB, int[] freqC, int maxB, StringBuilder out) {
        int maxC;
        int count = maxB;
        for (int i = 0; i < 26; i++) {
            freqA[i] -= freqB[i] * maxB;
        }
        while (maxB > 0) {
            out.append(b);
            maxB--;
        }

        maxC = Integer.MAX_VALUE;
        for (int i = 0; i < 26; i++) {
            if (freqC[i] != 0)
                maxC = Math.min(maxC, freqA[i] / freqC[i]);
        }
        count += maxC;
        for (int i = 0; i < 26; i++) {
            freqA[i] -= freqC[i] * maxC;
        }
        while (maxC > 0) {
            out.append(c);
            maxC--;
        }
        return count;
    }


    private static int firstC(String b, String c, int[] freqA, int[] freqB, int[] freqC, int maxC, StringBuilder out) {
        int maxB;
        int count = maxC;
        for (int i = 0; i < 26; i++) {
            freqA[i] -= freqC[i] * maxC;
        }
        while (maxC > 0) {
            out.append(c);
            maxC--;
        }
        maxB = Integer.MAX_VALUE;
        for (int i = 0; i < 26; i++) {
            if (freqB[i] != 0)
                maxB = Math.min(maxB, freqA[i] / freqB[i]);
        }
        count += maxB;
        for (int i = 0; i < 26; i++) {
            freqA[i] -= freqB[i] * maxB;
        }
        while (maxB > 0) {
            out.append(b);
            maxB--;
        }
        return count;
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
    }
}