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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Problem551B {

	public static void main(String[] args) {
		Problem551B instance = new Problem551B();
		BufferedReader bfr = null;

		try {
			bfr = new BufferedReader(new InputStreamReader(System.in));
			String line = "";
			String a = "", b = "", c = "";
			if ((line = bfr.readLine()) != null) {
				a = line.trim();
			}
			if ((line = bfr.readLine()) != null) {
				b = line.trim();
			}
			if ((line = bfr.readLine()) != null) {
				c = line.trim();
			}

			instance.process(a, b, c);

		} catch (Throwable t) {
			System.err.println(t);
		} finally {
			if (bfr != null) {
				try {
					bfr.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

	}

	public void process(String sa, String sb, String sc) {
		int[] a = new int[26];
		int[] b = new int[26];
		int[] c = new int[26];

		for (int i = 0; i < sa.length(); i++) {
			a[sa.charAt(i) - 'a']++;
		}
		for (int i = 0; i < sb.length(); i++) {
			b[sb.charAt(i) - 'a']++;
		}
		for (int i = 0; i < sc.length(); i++) {
			c[sc.charAt(i) - 'a']++;
		}
		int[] temp = new int[26];

		for (int i = 0; i < 26; i++) {
			temp[i] = a[i];
		}

		int maxb = Integer.MAX_VALUE;
		for (int i = 0; i < 26; i++) {
			if (b[i] > 0) {
				maxb = Math.min(maxb, (temp[i] / b[i]));
			}
		}
		if (maxb == Integer.MAX_VALUE) {
			maxb = 0;
		}

		for (int i = 0; i < 26; i++) {
			temp[i] -= (maxb * b[i]);
		}

		int maxc = Integer.MAX_VALUE;
		for (int i = 0; i < 26; i++) {
			if (c[i] > 0) {
				maxc = Math.min(maxc, (temp[i] / c[i]));
			}
		}
		if (maxc == Integer.MAX_VALUE) {
			maxc = 0;
		}
		// System.out.println("bmax:" + maxb);
		// System.out.println("cmax:" + maxc);
		
		int total = maxb + maxc;
		int mb = maxb;
		int mc = maxc;
		boolean flag = true;
		while (flag) {

			for (int i = 0; i < 26; i++) {
				temp[i] = a[i];
			}
			if (maxb > 0) {
				mb = maxb;
				mc = maxc;
				maxb--;
				for (int i = 0; i < 26; i++) {
					temp[i] -= (maxb * b[i]);
				}
				maxc = Integer.MAX_VALUE;
				for (int i = 0; i < 26; i++) {
					if (c[i] > 0) {
						maxc = Math.min(maxc, (temp[i] / c[i]));
					}
				}
				if (maxc == Integer.MAX_VALUE) {
					maxc = 0;
				}
				if (maxb + maxc <= total) {
					flag = false;
				} else {
					total = maxb + maxc;
					mb = maxb;
					mc = maxc;
					// System.out.println("bmax:" + maxb);
					// System.out.println("cmax:" + maxc);
				}

			} else {
				flag = false;
			}
		}

		// System.out.println("maxb:" + mb);
		// System.out.println("maxc:" + mc);

		// System.out.println("total:" + total);

		for (int i = 0; i < 26; i++) {
			temp[i] = a[i] - (mb * b[i]) - (mc * c[i]);
		}

		StringBuffer msg = new StringBuffer();
		for (int i = 0; i < mb; i++) {
			msg.append(sb);
		}
		for (int i = 0; i < mc; i++) {
			msg.append(sc);
		}
		for (int i = 0; i < 26; i++) {
			while (temp[i] > 0) {
				msg.append((char) ('a' + i));
				temp[i]--;
			}
		}

		System.out.println(msg.toString());
	}
}
