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.ArrayList;
import java.util.Collections;
import java.util.Scanner;
 
 
public class Solving {
 
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		String a = input.next();
		String b = input.next();
		String c = input.next();
		int [] A = new int[26];
		int [] AA = new int[26];
		int [] B = new int[26];
		int [] C = new int[26];
		int [][] D = new int[100001][2];
		int minc = 0;
		ArrayList<Integer> Bmin = new ArrayList();
		ArrayList<Integer> Cmin = new ArrayList();
		ArrayList<Integer> max = new ArrayList();
		for(int i = 0; i < a.length(); i++){
			A[(int)a.charAt(i)- 'a']++;
		}
		for(int i = 0; i < b.length(); i++){
			B[(int)b.charAt(i)- 'a']++;
		}
		for(int i = 0; i < 26; i++){
			if(B[i] > 0){Bmin.add(A[i]/B[i]);
			}
		}
		int minb = Collections.min(Bmin);
		for(int i = 0; i < c.length(); i++){
			C[(int)c.charAt(i)-'a']++;
		}
		while(minb >= 0){
			for(int r = 0; r < 26; r++){
				AA[r] = A[r];
			}
			for(int i = 0; i < 26; i++){
				
			if(B[i] > 0){AA[i] = A[i] - (minb*B[i]);
			}}
			for(int i = 0; i < 26; i++){
				if(C[i] > 0){Cmin.add(AA[i]/C[i]);}
			}
			minc = Collections.min(Cmin);
			int maxi = minc + minb;
			max.add(maxi);
			D[maxi][0] = minc;D[maxi][1] = minb; 
			minb--;
			Cmin.clear();
		}
		int fmax = Collections.max(max);
		for(int i = 0; i < D[fmax][1];i++){
			for(int j = 0; j < b.length(); j++){
				System.out.print(b.charAt(j));
			}
		}
		if(D[fmax][1]>0){
		for(int i = 0; i < 26; i++){
			if(B[i] > 0){A[i] = A[i] - (B[i]*D[fmax][1]);}
		}}
		for(int i = 0; i < D[fmax][0]; i++){
			for(int j = 0; j < c.length(); j++){
				System.out.print(c.charAt(j));
			}
		}
		if(D[fmax][0]>0){
			for(int i = 0; i < 26; i++){
				if(C[i] > 0){A[i] = A[i] - (C[i]*D[fmax][0]);} 
			}}
		for(int i = 0; i < 26; i++){
			if(A[i] > 0){for(int j = 0; j < A[i]; j++){
				System.out.print((char)(i+97));
			}}}
	}}