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.util.*; 
import java.math.*;
import java.io.*;
public class Main{static long[] hum;
    public static void main(String[] args)  throws IOException {
       InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner input = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        String a= input.next();
        String b= input.next();
        String c= input.next();
        int[] alp1=new int[26];
        int[] alp2=new int[26];
        int[] alp3=new int[26];
        for(int i=0;i<a.length();i++)
            alp1[a.charAt(i)-'a']++;
        for(int i=0;i<b.length();i++)
            alp2[b.charAt(i)-'a']++;
        for(int i=0;i<c.length();i++)
            alp3[c.charAt(i)-'a']++;
        int min=100000;
        int l=0;
        for(int i=0;i<26;i++){
            if(alp2[i]>0)
                min=Math.min(min,alp1[i]/alp2[i]);
            l+=alp2[i];
            if(min==0||l==b.length())
                break;
        }
        int min2=100000;
        String h="";
        int m=0;
        for(int i=0;i<26;i++){
            if(alp3[i]>0)
                min2=Math.min(min2,alp1[i]/alp3[i]);
            m+=alp3[i];
            if(min2==0||m==c.length())
                break;
        }
        int u;
        int[] x=new int[26];
        
        if(min2>min){
            h=b;
            b=c;
            c=h;
            u=min2;
            min2=min;
            min=u;
        for(int i=0;i<26;i++){
            x[i]=alp2[i];
            alp2[i]=alp3[i];
            alp3[i]=x[i];
        }
        
        }
            
        StringBuilder res = new StringBuilder();
        for(int i=0;i<min;i++)
            res.append(b);
        l=0;
        for(int i=0;i<26;i++){
            l+=alp2[i];
            if(alp2[i]>0)
            alp1[i]-=min*alp2[i];
        if(l==b.length())
            break;
        }
        
         min2=100000;
         l=0;
        for(int i=0;i<26;i++){
            if(alp3[i]>0)
                min2=Math.min(min2,alp1[i]/alp3[i]);
            l+=alp3[i];
            if(min2==0||l==c.length())
                break;
        }
        for(int i=0;i<min2;i++)
          res.append(c);
        l=0;
        for(int i=0;i<26;i++){
            l+=alp3[i];
            if(alp3[i]>0)
                alp1[i]-=min2*alp3[i];
            if(l==c.length())
                break;
        }
        
        char[] p=a.toCharArray();
        for(int i=0;i<a.length();i++){
            char ch=a.charAt(i);
            if(alp1[ch-'a']>0){
                res.append(ch+"");
            
                alp1[ch-'a']--;
            }
        }
                
            
       out.println(res);
       out.close();
    }
    
            
    static class FastScanner {
    private StringTokenizer tokenizer;
    private BufferedReader reader;

    public FastScanner(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = null;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                }
            if (line == null)
                return null;
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

}
}   