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.InputStreamReader;
import java.io.PrintWriter;

public class R307qB {

	public static void main(String args[] ) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    PrintWriter w = new PrintWriter(System.out);
	        
	    char a[] = br.readLine().toCharArray();
	    char b[] = br.readLine().toCharArray();
	    char c[] = br.readLine().toCharArray();
	    
	    int xa[] = new int[26];
	    for(char x : a)
	    	xa[x- 'a']++;
	    
	    int xb[] = new int[26];
	    for(char x : b)
	    	xb[x- 'a']++;
	    
	    int xc[] = new int[26];
	    for(char x : c)
	    	xc[x- 'a']++;
	    
	    int a1 = a.length,a2 = a.length;
	    
	    int orig[] = new int[26];
	    System.arraycopy(xa, 0, orig, 0, 26);
	    
	    int orig2[] = new int[26];
	    System.arraycopy(xa,0,orig2,0,26);
	   
	    int ans1 = 0;
	    
	    int min = a.length;
	    for(int i=0;i<26;i++)
	    	min = xb[i] != 0 ? Math.min(min, xa[i] / xb[i]) : min;
	    
	    ans1 += min;
	    for(int i=0;i<26;i++)
	    	xa[i] -= min * xb[i];
	    
	    a1 = min;
	    
	    min = a.length;
	    for(int i=0;i<26;i++)
	    	min = xc[i] != 0 ? Math.min(min, xa[i] / xc[i]) : min;
	    ans1 += min;
	    
	    a2 = min;
	    
	    int ans2 = 0;
	    
	    int c1 = a.length,c2 = a.length;
	    
	    min = a.length;
	    for(int i=0;i<26;i++)
	    	min = xc[i] != 0 ? Math.min(min, orig[i]/xc[i]) : min;
	    
	    ans2 += min;
	    for(int i=0;i<26;i++)
	    	orig[i] -= min * xc[i];
	    
	    c1 = min;
	    
	    min = a.length;
	    for(int i=0;i<26;i++)
	    	min = xb[i] != 0 ? Math.min(min,orig[i]/xb[i]) : min;
	    
	    ans2 += min;
	    
	    c2 = min;
	    
	    if(ans1 >= ans2){
	    	for(int i=0;i<a1;i++)
	    		w.print(new String(b));
	    	for(int i=0;i<a2;i++)
	    		w.print(new String(c));
	    	for(int i=0;i<26;i++)
	    		orig2[i] -= xb[i] * a1;
	    	for(int i=0;i<26;i++)
	    		orig2[i] -= xc[i] * a2;
	    	for(int i=0;i<26;i++)
	    		for(int j=0;j<orig2[i];j++)
	    			w.print((char)('a' + i));
	    	w.println();
	    }
	    
	    else{
	    	for(int i=0;i<c1;i++)
	    		w.print(new String(c));
	    	for(int i=0;i<c2;i++)
	    		w.print(new String(b));
	    	for(int i=0;i<26;i++)
	    		orig2[i] -= xb[i] * c2;
	    	for(int i=0;i<26;i++)
	    		orig2[i] -= xc[i] * c1;
	    	for(int i=0;i<26;i++)
	    		for(int j=0;j<orig2[i];j++)
	    			w.print((char)('a' + i));
	    	w.println();
	    }
	    
	    w.close();
	        
	}
	
	public static int ip(String s){
		return Integer.parseInt(s);
	}
}
