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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		/* Read in from console */
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter writer = new PrintWriter(System.out);
		
		String a = reader.readLine();
		String b = reader.readLine();
		String c = reader.readLine();
		
		int[] countsA = new int[26];
		int[] countsA2 = new int[26];
		int[] countsB = new int[26];
		int[] countsC = new int[26];
		
		for(int i=0; i<a.length(); i++){
			char temp = a.charAt(i);
			countsA[temp-'a']++;
			countsA2[temp-'a']++;
		}
		
		for(int i=0; i<b.length(); i++){
			char temp = b.charAt(i);
			countsB[temp-'a']++;
		}
		
		for(int i=0; i<c.length(); i++){
			char temp = c.charAt(i);
			countsC[temp-'a']++;
		}
		
		int minA = Integer.MAX_VALUE;
		int minAB = Integer.MAX_VALUE;
		int minB = Integer.MAX_VALUE;
		int minBB = Integer.MAX_VALUE;
		
		for(int i=0; i<b.length(); i++){
			char temp = b.charAt(i);
			if(countsB[temp-'a'] > 0){
				int t = countsA[temp-'a']/countsB[temp-'a'];
				if(t < minA)
					minA = t;
			}	
		}
		for(int i=0; i<b.length(); i++){
			countsA[b.charAt(i)-'a'] -= minA;
		}
		
		for(int i=0; i<c.length(); i++){
			char temp = c.charAt(i);
			if(countsC[temp-'a'] > 0){
				int t = countsA[temp-'a']/countsC[temp-'a'];
				if(t < minAB)
					minAB = t;
			}	
		}
		for(int i=0; i<c.length(); i++){
			countsA[c.charAt(i)-'a'] -= minAB;
		}
		
		for(int i=0; i<c.length(); i++){
			char temp = c.charAt(i);
			if(countsC[temp-'a'] > 0){
				int t = countsA2[temp-'a']/countsC[temp-'a'];
				if(t < minB)
					minB = t;
			}	
		}
		for(int i=0; i<c.length(); i++){
			countsA2[c.charAt(i)-'a'] -= minB;
		}
		
		for(int i=0; i<b.length(); i++){
			char temp = b.charAt(i);
			if(countsB[temp-'a'] > 0){
				int t = countsA2[temp-'a']/countsB[temp-'a'];
				if(t < minBB)
					minBB = t;
			}	
		}
		for(int i=0; i<b.length(); i++){
			countsA2[b.charAt(i)-'a'] -= minBB;
		}
		
		StringBuilder build = new StringBuilder();
		
		if(minA == Integer.MAX_VALUE)
			minA = 0;
		if(minAB == Integer.MAX_VALUE)
			minAB = 0;
		if(minB == Integer.MAX_VALUE)
			minB = 0;
		if(minBB == Integer.MAX_VALUE)
			minBB = 0;

		
		if(minA+minAB > minB+minBB){
			
			
			for(int i=0; i<minA; i++)
				build.append(b);
			
			for(int i=0; i<minAB; i++)
				build.append(c);
			
			for(int i=0; i<26; i++)
				if(countsA[i] > 0)
					for(int j=0; j<countsA[i]; j++)
						build.append((char)(i+'a'));
			
		}
		else{
			
			for(int i=0; i<minB; i++)
				build.append(c);
			
			for(int i=0; i<minBB; i++)
				build.append(b);
			
			for(int i=0; i<26; i++)
				if(countsA[i] > 0)
					for(int j=0; j<countsA[i]; j++)
						build.append((char)(i+'a'));
		}
		
		writer.println(build.toString());
		
		writer.close();
	}
}