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.util.Arrays;
import java.util.StringTokenizer;

public class R307Div2B {

	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		char[] a=in.nextToken().toCharArray();
		char[] b=in.nextToken().toCharArray();
		char[] c=in.nextToken().toCharArray();
		
		int[] aaa=new int[26];
		int[] bbb=new int[26];
		int[] ccc=new int[26];
		for(int i=0;i<a.length;i++)
			aaa[a[i]-'a']++;
		for(int i=0;i<b.length;i++)
			bbb[b[i]-'a']++;
		for(int i=0;i<c.length;i++)
			ccc[c[i]-'a']++;

		StringBuffer ans=new StringBuffer("");
		if(Arrays.equals(b,c)){
			int[] min=getMin(aaa, bbb, ccc, false);
			
			for(int i=0;i<min[0];i++){
				ans.append(String.valueOf(b));
			}
			for(int i=0;i<26;i++)
				aaa[i]-=min[0]*bbb[i];
			
			for(int i=0;i<26;i++)
				for(int j=0;j<aaa[i];j++)
					ans.append((char)(i+'a'));
		}else{
			int[] min1=getMin(aaa, bbb, ccc, true);
			int[] min2=getMin(aaa, ccc, bbb, true);
			if(min1[0]+min1[1]>=min2[0]+min2[1]){
				for(int i=0;i<min1[0];i++){
					ans.append(String.valueOf(b));
				}
				
				for(int i=0;i<min1[1];i++){
					ans.append(String.valueOf(c));
				}
				for(int i=0;i<26;i++){
					aaa[i]-=min1[0]*bbb[i];
					aaa[i]-=min1[1]*ccc[i];
				}
				
				for(int i=0;i<26;i++)
					for(int j=0;j<aaa[i];j++)
						ans.append((char)(i+'a'));
			}else{
				for(int i=0;i<min2[0];i++){
					ans.append(String.valueOf(c));
				}
				
				for(int i=0;i<min2[1];i++){
					ans.append(String.valueOf(b));
				}
				for(int i=0;i<26;i++){
					aaa[i]-=min2[0]*ccc[i];
					aaa[i]-=min2[1]*bbb[i];
				}
				
				for(int i=0;i<26;i++)
					for(int j=0;j<aaa[i];j++)
						ans.append((char)(i+'a'));
			}	
		}
		
		System.out.println(ans.toString());
	}
	
	static int[] getMin(int[] aaa,int[] bbb, int[] ccc, boolean f) {
		int min1=Integer.MAX_VALUE;
		int min2=Integer.MAX_VALUE;
		int[] bb=new int[26];
		for(int i=0;i<26;i++){
			if(bbb[i]>0)
				min1=Math.min(min1,aaa[i]/bbb[i]);
		}
		
		if(min1>0){
			for(int i=0;i<26;i++)
				bb[i]=min1*bbb[i];
		}
		
		if(f){
			for(int i=0;i<26;i++){
				if(ccc[i]>0)
					min2=Math.min(min2,(aaa[i]-bb[i])/ccc[i]);
			}
		}else{
			min2=0;
		}
		return new int[]{min1,min2};
	}
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(){br=new BufferedReader(new InputStreamReader(System.in));}
		String nextToken(){
			while(st==null||!st.hasMoreElements())
				try{st=new StringTokenizer(br.readLine());}catch(Exception e){}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(nextToken());}
		long nextLong(){return Long.parseLong(nextToken());}
		double nextDouble(){return Double.parseDouble(nextToken());}
	}
}
