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 Main {

	public void solve() {
		Scanner sc = new Scanner(System.in);

		char[] string = sc.next().toCharArray();
		String sA = sc.next();
		String sB = sc.next();
		sc.close();

		char[] a;
		char[] b;

		if (sA.length() < sB.length()) {
			a = sA.toCharArray();
			b = sB.toCharArray();
		} else {
			a = sB.toCharArray();
			b = sA.toCharArray();
		}

		int[] sNum = new int[26];
		for (int i = 0; i < string.length; i++) {
			sNum[string[i] - 'a']++;
		}
		int[] aNum = new int[26];
		for (int i = 0; i < a.length; i++) {
			aNum[a[i] - 'a']++;
		}
		int[] bNum = new int[26];
		for (int i = 0; i < b.length; i++) {
			bNum[b[i] - 'a']++;
		}

		StringBuilder ans = new StringBuilder();
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < 26; i++) {
			if (aNum[i] + bNum[i] == 0) {
				continue;
			}
			min = Math.min(min, sNum[i] / (aNum[i] + bNum[i]));
		}
		for (int i = 0; i < min; i++) {
			ans.append(String.valueOf(a) + String.valueOf(b));
		}
		for (int i = 0; i < 26; i++) {
			sNum[i] -= (aNum[i] + bNum[i]) * min;
		}

		min = Integer.MAX_VALUE;
		for (int i = 0; i < 26; i++) {
			if (aNum[i] == 0) {
				continue;
			}
			min = Math.min(min, sNum[i] / aNum[i]);
		}
		for (int i = 0; i < min; i++) {
			ans.append(String.valueOf(a));
		}
		for (int i = 0; i < 26; i++) {
			sNum[i] -= aNum[i] * min;
		}

		min = Integer.MAX_VALUE;
		for (int i = 0; i < 26; i++) {
			if (bNum[i] == 0) {
				continue;
			}
			min = Math.min(min, sNum[i] / bNum[i]);
		}
		for (int i = 0; i < min; i++) {
			ans.append(String.valueOf(b));
		}
		for (int i = 0; i < 26; i++) {
			sNum[i] -= bNum[i] * min;
		}
		for (int i = 0; i < 26; i++) {
			char c = (char) (i + 'a');
			for (int j = 0; j < sNum[i]; j++) {
				ans.append(c);
			}
		}
		System.out.println(ans.toString());
	}

	public static void main(String[] args) {
		new Main().solve();
	}
}