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


from sys import stdin

import fileinput
from collections import defaultdict

astr = stdin.readline().rstrip()
bstr = stdin.readline().rstrip()
cstr = stdin.readline().rstrip()

acnts = [0]*30#defaultdict(lambda: 0)
for c in astr:
	acnts[ord(c) - ord('a')] += 1

bcnts = [0]*30#defaultdict(lambda: 0)
for c in bstr:
	bcnts[ord(c) - ord('a')] += 1

ccnts = [0]*30#defaultdict(lambda: 0)
for c in cstr:
	ccnts[ord(c) - ord('a')] += 1


def getCount(counts, acounts):
	maxcount = 10**5
	for idx, count in enumerate(counts):
		if count > 0:
			maxcount = min(maxcount, acounts[idx]//count)
	return maxcount

maxb = getCount(bcnts, acnts)
maxc = getCount(ccnts, acnts)

'''
maxb = 10**5
for key, val in bcnts.items():
	maxb = min(maxb, acnts[key]//val)

maxc = 10**5
for key, val in ccnts.items():
	maxc = min(maxc, acnts[key]//val)
'''
bees = 0
cees = 0
best = 0

if maxb < maxc:
	for bcnt in xrange(maxb + 1):
		for idx, count in enumerate(bcnts):
			acnts[idx] -= bcnt*count
		ccnt = getCount(ccnts, acnts)
		if ccnt + bcnt > best:
			bees = bcnt
			cees = ccnt
			best = ccnt + bcnt
		for idx, count in enumerate(bcnts):
			acnts[idx] += bcnt*count
else:
	for ccnt in xrange(maxc + 1):
		for idx, count in enumerate(ccnts):
			acnts[idx] -= ccnt*count
		bcnt = getCount(bcnts, acnts)
		if ccnt + bcnt > best:
			bees = bcnt
			cees = ccnt
			best = ccnt + bcnt
		for idx, count in enumerate(ccnts):
			acnts[idx] += ccnt*count


for idx, count in enumerate(bcnts):
	acnts[idx] -= bees*count
for idx, count in enumerate(ccnts):
	acnts[idx] -= cees*count

res = []
for i in xrange(bees):
	res.append(bstr)
for i in xrange(cees):
	res.append(cstr)

for idx, count in enumerate(acnts):
	res.append(chr(idx + ord('a'))*count)

print "".join(res)



