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

public class B {
	
	public static int min(int[] alpha, String b, int[] balpha) {
		int min = 2000000000;
		for(int i=0; i<26; i++)
			if(balpha[i] != 0)
				min = Math.min(min, alpha[i]/balpha[i]);
		return min;
	}
	
	public static void erase(int[] alpha, int[] balpha, int minb) {
		for(int i=0; i<26; i++)
			if(balpha[i] != 0)
				alpha[i] -= balpha[i]*minb;
	}

    public static void main(String[] args) throws Exception {
    	BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
    	String a = buffer.readLine();
    	String b = buffer.readLine();
    	String c = buffer.readLine();
    	int[] alpha = new int[26];
    	int[] alpha1 = new int[26];
    	int[] alpha2 = new int[26];
    	int[] alpha3 = new int[26];
    	int[] alpha4 = new int[26];
    	for(int i=0; i<a.length(); i++) {
    		alpha[(int)(a.charAt(i)-'a')]++;
    		alpha1[(int)(a.charAt(i)-'a')]++;
    		alpha2[(int)(a.charAt(i)-'a')]++;
    		alpha3[(int)(a.charAt(i)-'a')]++;
    		alpha4[(int)(a.charAt(i)-'a')]++;
    	}
    	String ans;
    	String bc = b+c;
    	int[] bcalpha = new int[26];
		for(int i=0; i<bc.length(); i++)
			bcalpha[(int)(bc.charAt(i)-'a')]++;
		int[] balpha = new int[26];
		for(int i=0; i<b.length(); i++)
			balpha[(int)(b.charAt(i)-'a')]++;
		int[] calpha = new int[26];
		for(int i=0; i<c.length(); i++)
			calpha[(int)(c.charAt(i)-'a')]++;
		int minb, minc, minbc;
		int min1, min2, min3, min4;
		// case 1
		minb = min(alpha1, b, balpha);
		erase(alpha1, balpha, minb);
		minc = min(alpha1, c, calpha);
		erase(alpha1, calpha, minc);
		min1 = minb + minc;
		// case 2
		minc = min(alpha2, c, calpha);
		erase(alpha2, calpha, minc);
		minb = min(alpha2, b, balpha);
		erase(alpha2, balpha, minb);
		min2 = minb + minc;
		// case 3
		minbc = min(alpha3, bc, bcalpha);
		erase(alpha3, bcalpha, minbc);
		minb = min(alpha3, b, balpha);
		erase(alpha3, balpha, minb);
		minc = min(alpha3, c, calpha);
		erase(alpha3, calpha, minc);
		min3 = minb + minc + minbc;
		// case 4	
		minbc = min(alpha4, bc, bcalpha);
		erase(alpha4, bcalpha, minbc);	
		minc = min(alpha4, c, calpha);
		erase(alpha4, calpha, minc);
		minb = min(alpha4, b, balpha);
		erase(alpha4, balpha, minb);	
		min4 = minb + minc + minbc;
		int min = Math.max(Math.max(min1, min2), Math.max(min3, min4));
		//System.out.println(min1 + " " + min2 + " " + min3 + " " + min4);
		if(min == min1) {
				minb = min(alpha, b, balpha);
				for(int i=0; i<minb; i++)
					System.out.print(b);
				erase(alpha, balpha, minb);
				minc = min(alpha, c, calpha);
				for(int i=0; i<minc; i++)
					System.out.print(c);
				erase(alpha, calpha, minc);
		}
		else if(min == min2) {
				minc = min(alpha, c, calpha);
				for(int i=0; i<minc; i++)
					System.out.print(c);
				erase(alpha, calpha, minc);
				minb = min(alpha, b, balpha);
				for(int i=0; i<minb; i++)
					System.out.print(b);
				erase(alpha, balpha, minb);
		}
		else if(min == min3) {
				minbc = min(alpha, bc, bcalpha);
				for(int i=0; i<minbc; i++)
					System.out.print(bc);
				erase(alpha, bcalpha, minbc);
				minb = min(alpha, b, balpha);
				for(int i=0; i<minb; i++)
					System.out.print(b);
				erase(alpha, balpha, minb);
				minc = min(alpha, c, calpha);
				for(int i=0; i<minc; i++)
					System.out.print(c);
				erase(alpha, calpha, minc);
		}
		else {
				minbc = min(alpha, bc, bcalpha);
				for(int i=0; i<minbc; i++)
					System.out.print(bc);
				erase(alpha, bcalpha, minbc);
				minc = min(alpha, c, calpha);
				for(int i=0; i<minc; i++)
					System.out.print(c);
				erase(alpha, calpha, minc);
				minb = min(alpha, b, balpha);
				for(int i=0; i<minb; i++)
					System.out.print(b);
				erase(alpha, balpha, minb);
		}
	    for(int i=0; i<26; i++)
			for(int j=0; j<alpha[i]; j++)
				System.out.print((char)(i+'a'));
    }
}