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


/**
 *
 * @author sarthak
 */
import java.util.*;
import java.math.*;
import java.io.*;
import javax.print.DocFlavor;

public class rnd307_B {

    static char[] a;//= s.next().toCharArray();
    static char[] b;//= s.next().toCharArray();
    static char[] c;//= s.next().toCharArray();
    static int[] ac = new int[27];
    static int[] cc = new int[27];
    static int[] bc = new int[27];
    static String A,B,C;

    static class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

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

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

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

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

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

    static class P implements Comparable {

        private int x, y;

        public P(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x * 31) ^ y;
        }

        public boolean equals(Object o) {
            if (o instanceof P) {
                P other = (P) o;
                return (x == other.x && y == other.y);
            }
            return false;
        }

        public int compareTo(Object obj) {
            P l = (P) obj;
            if (this.x == l.x) {
                if (this.y == l.y) {
                    return 0;
                }
                return (this.y < l.y) ? -1 : 1;
            }
            return (this.x < l.x) ? -1 : 1;
        }
    }

    public static void init() {
        Arrays.fill(cc,0);Arrays.fill(bc,0);Arrays.fill(ac,0);
        for (char ch : a) {
            ac[ch - 'a']++;
        }
        for (char ch : b) {
            bc[ch - 'a']++;
        }
        for (char ch : c) {
            cc[ch - 'a']++;
        }
    }

    public static void main(String[] args) {

        FastScanner s = new FastScanner(System.in);
        StringBuilder op = new StringBuilder();
        a=s.next().toCharArray();b=s.next().toCharArray();c=s.next().toCharArray();
        init();
        
        int cnt1 = 0;
        int mn = Integer.MAX_VALUE;
        for (int i = 0; i < 26; i++) {
            if (bc[i] != 0) {
                mn = Math.min(mn, ac[i] / bc[i]);
            }
        }

        for (int i = 0; i < 26; i++) {
            ac[i] = ac[i] - mn * (bc[i]);
        }
        cnt1 += mn;
        mn = Integer.MAX_VALUE;

        for (int i = 0; i < 26; i++) {
            if (cc[i] != 0) {
                mn = Math.min(mn, ac[i] / cc[i]);
            }
        }
        cnt1 += mn;

        
        init();
        int cnt2 = 0;
        mn = Integer.MAX_VALUE;

        for (int i = 0; i < 26; i++) {
            if (cc[i] != 0) {
                mn = Math.min(mn, ac[i] / cc[i]);
            }
        }
        cnt2 += mn;
        for (int i = 0; i < 26; i++) {
            ac[i] = ac[i] - mn * (cc[i]);
        }
        mn = Integer.MAX_VALUE;
        for (int i = 0; i < 26; i++) {
            if (bc[i] != 0) {
                mn = Math.min(mn, ac[i] / bc[i]);
            }
        }
        cnt2 += mn;
        for (int i = 0; i < 26; i++) {
            ac[i] = ac[i] - mn * (bc[i]);
        }

        if (cnt1 > cnt2) {
            init();
            mn = Integer.MAX_VALUE;
            for (int i = 0; i < 26; i++) {
                if (bc[i] != 0) {
                    mn = Math.min(mn, ac[i] / bc[i]);
                }
            }
            //   System.out.println("yo " +  mn +"   "+ cnt1);
            for (int i = 0; i < mn; i++) {
                op.append(new String(b));
            }
            for (int i = 0; i < 26; i++) {
                ac[i] = ac[i] - mn * (bc[i]);
            }
            for(int i=0;i<mn;i++)
                op.append(new String(b));
            mn = Integer.MAX_VALUE;

            for (int i = 0; i < 26; i++) {
                if (cc[i] != 0) {
                    mn = Math.min(mn, ac[i] / cc[i]);
                }
            }
            for (int i = 0; i < mn; i++) {
                op.append(new String(c));
            }
            for (int i = 0; i < 26; i++) {
                ac[i] = ac[i] - mn * cc[i];
            }
            for (int i = 0; i < 26; i++) {
                for (int j = 0; j < ac[i]; j++) {
                    op.append((char) (i + 'a'));
                }
            }

            System.out.println(op);
        } else {

            init();
            mn = Integer.MAX_VALUE;
            for (int i = 0; i < 26; i++) {
                if (cc[i] != 0) {
                    mn = Math.min(mn, ac[i] / cc[i]);
                }
            }
            for (int i = 0; i < mn; i++) {
                op.append(new String(c));
            }
            for (int i = 0; i < 26; i++) {
                ac[i] = ac[i] - mn * (cc[i]);
            }
            mn = Integer.MAX_VALUE;

            for (int i = 0; i < 26; i++) {
                if (bc[i] != 0) {
                    mn = Math.min(mn, ac[i] / bc[i]);
                }
            }
            for (int i = 0; i < mn; i++) {
                op.append(new String(b));
            }
            for (int i = 0; i < 26; i++) {
                ac[i] = ac[i] - mn * bc[i];
            }
            for (int i = 0; i < 26; i++) {
                for (int j = 0; j < ac[i]; j++) {
                    op.append((char) (i + 'a'));
                }
            }

            System.out.println(op);

        }

    }

}
