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.*;
public class Maximus {
public static void main(String [] args){
	Scanner in=new Scanner(System.in);
	String a=in.next();
	String b=in.next();
	String c=in.next();
	int a1[]=new int[26];
	int b1[]=new int[26];
	int c1[]=new int[26];
	for(int i=0;i<a.length();i++)
		a1[a.charAt(i)-'a']++;
	for(int i=0;i<b.length();i++)
		b1[b.charAt(i)-'a']++;
	for(int i=0;i<c.length();i++)
		c1[c.charAt(i)-'a']++;
	boolean flag=true;
	int min=10000000;
	for(int i=0;i<26;i++){
		if(a1[i] < b1[i])flag=false;
		else if(b1[i] > 0)
		min=Math.min(a1[i]/b1[i],min);
	}
		int ans=0;
		int ans1=0;
		StringBuilder sb=new StringBuilder();
		StringBuilder sb1=new StringBuilder();
	if(flag){
		int temp[]=a1.clone();
		for(int i=0;i<min;i++){
			sb.append(b);
		}
		//System.out.println(min);
		ans+=min;
		for(int i=0;i<26;i++)
			temp[i]-=min*(b1[i]);
			min=0;
		for(int i=0;i<26;i++){
			if(c1[i] > temp[i])flag=false;
			else if(c1[i] > 0)
			min=Math.min(min,temp[i]/c1[i]);
		}
		ans+=min;
		if(flag){
		for(int i=0;i<min;i++)
		sb.append(c);
		for(int i=0;i<26;i++)temp[i]-=min*c1[i];
		}
		for(int i=0;i<26;i++){
			for(int j=0;j<temp[i];j++)sb.append((char)(i+97));
		}	
	}
	else sb=new StringBuilder(a);
	boolean flag1=true;
	min=0;
	for(int i=0;i<26;i++){
		if(a1[i] < c1[i])flag1=false;
		else if(c1[i] > 0)
		min=Math.min(a1[i]/c1[i],min);	
}
    if(flag1){
    	int temp[]=a1.clone();
    	for(int i=0;i<min;i++){
			sb1.append(c);
		}
		ans1+=min;
		for(int i=0;i<26;i++)
			temp[i]-=min*(c1[i]);
			min=0;
		for(int i=0;i<26;i++){
			if(b1[i] > temp[i])flag1=false;
			else if(b1[i] > 0)
			min=Math.min(min,temp[i]/b1[i]);
		}
		ans1+=min;
		if(flag1){
		for(int i=0;i<min;i++)
		sb1.append(b);
		for(int i=0;i<26;i++)temp[i]-=min*b1[i];
		}
		for(int i=0;i<26;i++){
			for(int j=0;j<temp[i];j++)sb1.append((char)(i+97));
		}	
    }
    else sb1=new StringBuilder(b);
    if(ans1 > ans)System.out.print(sb1);
    else System.out.print(sb);
}
    }






