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 Main {
public static void main(String [] args){
	Scanner in=new Scanner(System.in);
	String a1=in.next();
	String b1=in.next();
	String c1=in.next();
	
	int a[]=new int[26];
	int b[]=new int[26];
	int c[]=new int[26];
	for(int i=0;i<a1.length();i++)
		a[a1.charAt(i)-'a']++;
	for(int i=0;i<b1.length();i++)
		b[b1.charAt(i)-'a']++;
	for(int i=0;i<c1.length();i++)
		c[c1.charAt(i)-'a']++;
		
		int min=100005;
		int min1=100005;
		boolean flag=true;
		boolean flag1=true;
	for(int i=0;i<26;i++){
		if(a[i] < b[i])flag=false;
		if(a[i] < c[i])flag1=false;
		if(b[i] > 0)
		min=Math.min(min,a[i]/b[i]);
		if(c[i] > 0)
		min1=Math.min(min1,a[i]/c[i]);
	}
	//System.out.println(flag +" "+flag1);
	 StringBuilder sb=new StringBuilder();
	 if(!flag1 && !flag){
	 	System.out.print(a1);
	 }
	 if(flag1 && !flag){
	 	for(int i=0;i<min1;i++){
	 		sb.append(c1);
	 	}
	 	for(int i=0;i<26;i++){
	 		for(int j=0;j<a[i]-min1*c[i];j++)sb.append((char)(i+97));
	 	}
	 	System.out.print(sb);
	 }
	 if(!flag1 && flag){
	 	for(int i=0;i<min;i++)sb.append(b1);
	 	for(int i=0;i<26;i++)
	 		for(int j=0;j<a[i]-min*b[i];j++)sb.append((char)(i+97));
	 		System.out.print(sb);
	 }
	 if(flag && flag1){
	 	int cnt=0;
	 	int ansB=0;int ansC=0;
	 	for(int i=0;i<=min;i++){
	 		flag=true;
	 		int var=10000000;
	 		for(int j=0;j<26;j++){
	 			cnt=a[j]-i*b[j];
	 		    if(c[j] > 0)var=Math.min(var,cnt/c[j]);
	 		}
	 		if(ansB + ansC < i+var){
	 			ansB=i;ansC=var;
	 		}
	 	}
	 	//System.out.println(ansB+" "+ansC);
	 	for(int i=0;i<ansB;i++)sb.append(b1);
	 	for(int i=0;i<ansC;i++)sb.append(c1);
	 	for(int i=0;i<26;i++)for(int j = 0;j < a[i] - ansB*b[i] - ansC*c[i];j++)sb.append((char)(i+97));
	 	System.out.print(sb);
	 }
	}
}