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.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;


public class ZgukistringZ {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String a = s.next();
		String b = s.next();
		String c = s.next();
		int[] aa = new int[26];
		int[] ab = new int[26];
		int[] ac = new int[26];
		Arrays.fill(aa, 0);
		Arrays.fill(ab, 0);
		Arrays.fill(ac, 0);
		String str = "abcdefghijklmnopqrstuvwxyz";
		for(int i = 0; i < a.length(); i++) {
			aa[a.charAt(i)-'a']++;
		}
		for(int i = 0; i < b.length(); i++) {
			ab[b.charAt(i)-'a']++;
		}
		for(int i = 0; i < c.length(); i++) {
			ac[c.charAt(i)-'a']++;
		}
		int maxb = 999999999;
		int maxc = 999999999;
//		int maxb2 = 999999999;
//		int maxc2 = 999999999;
//		System.out.println(Arrays.toString(aa));
//		System.out.println(Arrays.toString(ab));
//		System.out.println(Arrays.toString(ac));
		for(int i = 0; i < 26; i++) {
			if(ab[i] > 0)
				maxb = Math.min(maxb, aa[i]/ab[i]);
		}
//		System.out.println("\n"+maxb+"___"+maxc);
		for(int i = 0; i < 26; i++) {
			int mx = 999999999;
			if(ac[i] > 0)
				mx = ((aa[i] - maxb*ab[i])/ac[i]);
			maxc = Math.min(maxc,  mx);
		}
//		System.out.println("\n"+maxb+"___"+maxc);
		while(maxb > 0 && maxb < 999999999) {
			System.out.print(b);
			for(int i = 0;i < 26; i++) {
				if(ab[i] > 0)
					aa[i] -= ab[i]; 
			}
			maxb--;
		}
		while(maxc > 0 && maxc < 999999999) {
			System.out.print(c);
			for(int i = 0;i < 26; i++) {
				if(ac[i] > 0)
					aa[i] -= ac[i]; 
			}
			maxc--;
		}
		for(int i = 0;i < 26; i++) {
			while(aa[i] > 0) {
				System.out.print(str.charAt(i));
				aa[i]--;
			}
		}
		
		
	}

}
/*
 lemigazalemiolemilicomzalemljenje
lemi
zlo
Output
lemilemilemilemiaaaceegjjllmnoozz
Answer
lemilemilemilemizlozloaaaceegjjmn
---------
mztskopjetisisampiosrcenaterenostaviajdezanaspobedi
mzt
optee
Output
mztmztopteeopteeaaaaaabcddeeiiiiijjknnnooprrssssssv
Answer
mztopteeopteeopteeaaaaaabcddiiiiijjkmnnnorrssssssvz
-----------
bumbumdzejsikerol
bumbum
bum
Output
bumbumdeeijklorsz
Answer
bumbumdeeijklorsz
--------------
*/
