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.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;


public class b_prob {

    static class FastScanner{
        BufferedReader s;
        StringTokenizer st;
        
        public FastScanner(){
            st = new StringTokenizer("");
            s = new BufferedReader(new InputStreamReader(System.in));
        }
        
        public FastScanner(File f) throws FileNotFoundException{
            st = new StringTokenizer("");
            s = new BufferedReader (new FileReader(f));
        }
        
        public int nextInt() throws IOException{
            if(st.hasMoreTokens())
                return Integer.parseInt(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextInt();
            }
        }
        
      public double nextDouble() throws IOException{
            if(st.hasMoreTokens())
                return Double.parseDouble(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextDouble();
            }
        }
      
        public long nextLong() throws IOException{
            if(st.hasMoreTokens())
                return Long.parseLong(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextLong();
            }
        }
        
        public String nextString() throws IOException{
            if(st.hasMoreTokens())
                return st.nextToken();
            else{
                st = new StringTokenizer(s.readLine());
                return nextString();
            }
            
        }
        public String readLine() throws IOException{
            return s.readLine();
        }
        
        public void close() throws IOException{
            s.close();
        }
        
    }
     private static FastScanner s = new FastScanner();   
     private static PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));
     
      static int count=0;
      static int inf= Integer.MAX_VALUE/2;
     public static void main(String[] args) throws IOException 
     {
        String a=s.nextString();
        String b=s.nextString();
        String c=s.nextString();
        int first1[] = new int[26];
        int first2[] = new int[26];
        for(int i=0;i<a.length();i++)
        {
            first1[a.charAt(i)-'a']++;
            first2[a.charAt(i)-'a']++;
        }
        int s1[]=new int[26];
        for(int i=0;i<b.length();i++)
        {
            s1[b.charAt(i)-'a']++;
        }
        int s2[] = new int[26];
        for(int i=0;i<c.length();i++)
        {
            s2[c.charAt(i)-'a']++;
        }
        int k=0,count1=0,count2=0,count3=0,count4=0;
        while(first1[b.charAt(k)-'a']!=0)
        {
            k++;
            if(k==b.length())
            {
                k=0;
                for(int p=0;p<b.length();p++)
                {
                    first1[b.charAt(p)-'a']--;
                }
                count1++;
            }
            if(first1[b.charAt(k)-'a']<0)
                {
                    count1--;
                    break;
                }
        }
        k=0;
        while(first2[c.charAt(k)-'a']!=0)
        {
            k++;
            if(k==c.length())
            {
                k=0;
                for(int p=0;p<c.length();p++)
                {
                    first2[c.charAt(p)-'a']--;
                }
                count2++;
            }
            if(first2[c.charAt(k)-'a']<0)
                {
                    count2--;
                    break;
                }
        }
        k=0;
         //System.out.println(" "+count1+" "+count2);
         StringBuffer sb=new StringBuffer(a);
        if(count1>=count2)
        {
            for(int i=0;i<count1;i++)
            {           
                System.out.print(""+b);
                for(int j=0;j<b.length();j++)
                {
                    sb.deleteCharAt(sb.indexOf(b.charAt(j)+""));
                }
            }
            k=0;
//            System.out.println("-->"+first1['a'-'a']);
//            System.out.println("-->"+first1['c'-'a']);
            while(first1[c.charAt(k)-'a']!=0)
            {
                k++;
                if(k==c.length())
                {
                    k=0;
                    for(int p=0;p<c.length();p++)
                    {
                        first1[c.charAt(p)-'a']--;
                    }
                    count3++;
                }
                if(first1[c.charAt(k)-'a']<0)
                {
                    count3--;
                    break;
                }
            }
            //System.out.println("-->"+(count3));
            for(int i=0;i<count3;i++)
            {
                System.out.print(""+c);
                for(int j=0;j<c.length();j++)
                {
                    try
                    {sb.deleteCharAt(sb.indexOf(c.charAt(j)+""));}
                    catch(Exception e)
                    {
                        
                    }
                }
            }
            System.out.print(sb);
        }
        else if(count2>count1)
        {
            for(int i=0;i<count2;i++)
            {
                System.out.print(""+c);
                for(int j=0;j<c.length();j++)
                {
                    sb.deleteCharAt(sb.indexOf(c.charAt(j)+""));
                }
            }
            while(first2[b.charAt(k)-'a']!=0)
            {
               k++;
               if(k==b.length())
               {
                   k=0;
                   for(int p=0;p<b.length();p++)
                   {
                        first2[b.charAt(p)-'a']--;
                   }
                   count4++;
               }
               if(first2[b.charAt(k)-'a']<0)
                {
                    count4--;
                    break;
                }
            }   
            for(int i=0;i<count4;i++)
            {
                System.out.print(""+b);
                for(int j=0;j<b.length();j++)
                {
                    sb.deleteCharAt(sb.indexOf(b.charAt(j)+""));
                }
            }
            System.out.print(sb);
        }
         s.close();
         ww.close();
     }
     public static int gcd(int a, int b){
        return b == 0 ? a : gcd(b,a%b);
    }
   
	
}