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.Scanner;

public class ZgukistringZ {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] a = in.nextLine().toCharArray();
		char[] b = in.nextLine().toCharArray();
		char[] c = in.nextLine().toCharArray();
		int[] an = new int[26];
		int[] bn = new int[26];
		int[] cn = new int[26];
		for (int i = 0; i < a.length; i++)
			an[a[i] - 'a']++;
		for (int i = 0; i < b.length; i++)
			bn[b[i] - 'a']++;
		for (int i = 0; i < c.length; i++)
			cn[c[i] - 'a']++;
		StringBuilder sb = new StringBuilder();
		int minb = Integer.MAX_VALUE;
		for (int i = 0; i < b.length; i++) {
			minb = Math.min(minb, an[b[i] - 'a'] / bn[b[i] - 'a']);
		}
		int minc = Integer.MAX_VALUE;
		for (int i = 0; i < c.length; i++) {
			minc = Math.min(minc, an[c[i] - 'a'] / cn[c[i] - 'a']);
		}
		if (minb * c.length >= minc * b.length) {
			for (int i = 0; i < b.length; i++) {
				an[b[i] - 'a'] -= minb;
			}
			while (minb > 0) {
				sb.append(b);
				minb--;
			}
			minc = Integer.MAX_VALUE;
			for (int i = 0; i < c.length; i++) {
				minc = Math.min(minc, an[c[i] - 'a'] / cn[c[i] - 'a']);
			}
			for (int i = 0; i < c.length; i++) {
				an[c[i] - 'a'] -= minc;
			}
			while (minc > 0) {
				sb.append(c);
				minc--;
			}
			for (int i = 0; i < 26; i++) {
				while (an[i] > 0) {
					sb.append((char) (i + 'a'));
					an[i]--;
				}
			}
		} else {

			for (int i = 0; i < c.length; i++) {
				an[c[i] - 'a'] -= minc;
			}
			while (minc > 0) {
				sb.append(c);
				minc--;
			}
			minb = Integer.MAX_VALUE;
			for (int i = 0; i < b.length; i++) {
				minb = Math.min(minb, an[b[i] - 'a'] / bn[b[i] - 'a']);
			}
			for (int i = 0; i < b.length; i++) {
				an[b[i] - 'a'] -= minb;
			}
			while (minb > 0) {
				sb.append(b);
				minb--;
			}
			for (int i = 0; i < 26; i++) {
				while (an[i] > 0) {
					sb.append((char) (i + 'a'));
					an[i]--;
				}
			}
		}
		System.out.println(sb);
	}

}
