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.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class B {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);

		String a, b, c;
		a = scanner.nextLine();
		b = scanner.nextLine();
		c = scanner.nextLine();
		
		int nA = a.length();
		int nB = b.length();
		int nC = c.length();
		
		// Create map of a
		Map<Character, Integer> mapA = new HashMap<Character, Integer>();
		for(int i = 0; i < nA; i++) {
			
			char letter = a.charAt(i);
			
			if(mapA.get(letter) == null) {
				mapA.put(letter, 1);
				
			}
			else {
				mapA.put(letter, mapA.get(letter) + 1);
				
			}
			
		}
		
		// Create map of b
		Map<Character, Integer> mapB = new HashMap<Character, Integer>();
		for(int i = 0; i < nB; i++) {
			
			char letter = b.charAt(i);
			
			if(mapB.get(letter) == null) {
				mapB.put(letter, 1);
				
			}
			else {
				mapB.put(letter, mapB.get(letter) + 1);
				
			}
			
		}
		
		// Create map of c
		Map<Character, Integer> mapC = new HashMap<Character, Integer>();
		for(int i = 0; i < nC; i++) {
			
			char letter = c.charAt(i);
			
			if(mapC.get(letter) == null) {
				mapC.put(letter, 1);
				
			}
			else {
				mapC.put(letter, mapC.get(letter) + 1);
				
			}
			
		}
		
		int sum = Integer.MAX_VALUE;
		int bAmount = 0;
		int cAmount = 0;
		StringBuilder left = new StringBuilder();
		
		for(Entry<Character, Integer> foo : mapB.entrySet()) {
			char letter = foo.getKey();
			int amount = foo.getValue();
			if(mapA.get(letter) != 0) {
				sum = Math.min(sum, mapA.get(letter)/amount);
				
			}
			
		}
		
		int best = 0;
		for(int i = 1; i <= sum; i++) {
			// Get amount of c
			int am = 0;
			for(Entry<Character, Integer> foo : mapC.entrySet()) {
				char letter = foo.getKey();
				int amount = foo.getValue();
				if(mapA.get(letter) != null) {
					if(mapB.get(letter) != null) {
						am = Math.min(am, mapA.get(letter)/(amount + mapB.get(letter) * i));
						
					}
					else {
						am = Math.min(am, mapA.get(letter)/(amount));
						
					}
					
					
				}
				
			}
			
			if(i + am > best) {
				best = i + am;
				bAmount = i;
				cAmount = am;
				
			}
			
		}
		
		for(Entry<Character, Integer> foo : mapB.entrySet()) {
			char letter = foo.getKey();
			if(mapA.get(letter) != null) {
				mapA.put(letter, mapA.get(letter) - foo.getValue() * bAmount);
				
			}
			
		}
		for(Entry<Character, Integer> foo : mapC.entrySet()) {
			char letter = foo.getKey();
			if(mapA.get(letter) != null) {
				mapA.put(letter, mapA.get(letter) - foo.getValue() * cAmount);
				
			}
			
		}
		
		for(Entry<Character, Integer> foo : mapA.entrySet()) {
			char letter = foo.getKey();
			int amount = foo.getValue();
			for(int i = 0; i < amount; i++) {
				left.append(letter);
				
			}
			
		}
		
		StringBuffer ans = new StringBuffer();
		for(int i = 0; i < bAmount; i++) {
			ans.append(b);
			
		}
		for(int i = 0; i < cAmount; i++) {
			ans.append(c);
			
		}
		ans.append(left);
		
		System.out.println(ans);
		
		
	}
	

}