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

"""def solve(a, b, c):
	aChars = [0 for i in range(26)]
	bChars = list(aChars)
	cChars = list(aChars)
	for i in range(len(a)):
		aChars[ord(a[i]) - 97] += 1
	for i in range(len(b)):
		bChars[ord(b[i]) - 97] += 1
	for i in range(len(c)):
		cChars[ord(c[i]) - 97] += 1

	numBFinal = getNumberofSubString(aChars, bChars)
	numCFinal = getNumberofSubString(aChars, cChars)
	numB = int(numBFinal)
	numC = int(numCFinal)
	best1 = 0
	new1 = ""
	for i in range(numB):
		new1 += b
		for i in range(len(aChars)):
			aChars[i] -= (bChars[i] * numB)
	numC = getNumberofSubString(aChars, cChars)
	best1 = numC + numBFinal
	for i in range(numC):
		new1 += c
		for i in range(len(aChars)):
			aChars[i] -= (cChars[i] * numC)
	for i in range(len(aChars)):
		new1 += chr(i + 97) * aChars[i]

	new2 = ""
	best2 = 0
	for i in range(numC):
		new2 += c
		for i in range(len(aChars)):
			aChars[i] -= (cChars[i] * numC)
	numB = getNumberofSubString(aChars, cChars)
	best2 = numB + numCFinal
	for i in range(numB):
		new2 += b
		for i in range(len(aChars)):
			aChars[i] -= (bChars[i] * numB)
	for i in range(len(aChars)):
		new2 += chr(i + 97) * aChars[i]
	if best1 > best2:
		return new1
	else:
		return new2"""

def solve2(a, b, c):
	aChars = [0 for i in range(26)]
	bChars = list(aChars)
	cChars = list(aChars)
	for i in range(len(a)):
		aChars[ord(a[i]) - 97] += 1
	for i in range(len(b)):
		bChars[ord(b[i]) - 97] += 1
	for i in range(len(c)):
		cChars[ord(c[i]) - 97] += 1

	numB = getNumberofSubString(aChars, bChars)
	numC = getNumberofSubString(aChars, cChars)

	bestB = 0
	bestC = 0

	best = 0
	for i in range(numB + 1):
		temp = list(aChars)
		for x in range(len(aChars)):
			temp[x] -= (bChars[x] * i)
		ans = getNumberofSubString(temp, cChars) + i
		if ans > best:
			bestB = i
			bestC = ans - i
		best = max(best, ans)

	for i in range(numC + 1):
		temp = list(aChars)
		for x in range(len(aChars)):
			temp[x] -= (cChars[x] * i)
		ans = getNumberofSubString(temp, bChars) + i
		if ans > best:
			bestC = i
			bestB = ans - i
		best = max(best, ans)

	new = ""

	new += b * bestB
	for i in range(len(aChars)):
		aChars[i] -= (bChars[i] * bestB)
	new += c * bestC
	for i in range(len(aChars)):
		aChars[i] -= (cChars[i] * bestC)
	for i in range(len(aChars)):
		new += chr(i + 97) * aChars[i]

	return new





def getNumberofSubString(a, sub):
	ans = 10 ** 6
	for i in range(len(a)):
		if (not (sub[i] == 0 and a[i] != 0)) and (not (sub[i] == 0 and a[i] == 0)):
			ans = min(ans, a[i] / sub[i])
	return ans


a1 = raw_input()
b1 = raw_input()
c1 = raw_input()
print solve2(a1, b1, c1)
