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

public class ZgukistringZ {

	ZgukistringZ() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		String a = br.readLine();
		String b = br.readLine();
		String c = br.readLine();

		int[] aCount = new int[1 + 'z' - 'a'];
		int[] bCount = new int[1 + 'z' - 'a'];
		int[] cCount = new int[1 + 'z' - 'a'];

		int bn = Integer.MAX_VALUE;
		int cn = Integer.MAX_VALUE;

		for (int i = 0; i < a.length(); i++) {
			aCount[a.charAt(i)-'a']++;
		}
		for (int i = 0; i < b.length(); i++) {
			bCount[b.charAt(i)-'a']++;
		}
		for (int i = 0; i < c.length(); i++) {
			cCount[c.charAt(i)-'a']++;
		}

		int[] aCount2 = aCount.clone();
		int bn2 = bn, cn2 = cn;
		
		// b max
		for (int i = 0; i < aCount.length; i++) {
			if (bCount[i] > 0) {
				bn = Math.min(bn,  aCount[i]/bCount[i]);
			}
		}

		for (int i = 0; i < aCount.length; i++) {
			aCount[i] -= bn*bCount[i];
		}
		
		for (int i = 0; i < aCount.length; i++) {
			if (cCount[i] > 0) {
				cn = Math.min(cn,  aCount[i]/cCount[i]);
			}
		}

		for (int i = 0; i < aCount.length; i++) {
			aCount[i] -= cn*cCount[i];
		}

		// c max
		for (int i = 0; i < aCount.length; i++) {
			if (cCount[i] > 0) {
				cn2 = Math.min(cn,  aCount2[i]/cCount[i]);
			}
		}

		for (int i = 0; i < aCount.length; i++) {
			aCount2[i] -= cn2*cCount[i];
		}
		
		for (int i = 0; i < aCount.length; i++) {
			if (bCount[i] > 0) {
				bn2 = Math.min(bn,  aCount2[i]/bCount[i]);
			}
		}

		for (int i = 0; i < aCount.length; i++) {
			aCount2[i] -= bn2*bCount[i];
		}
		
		if (bn + cn < bn2 + cn2) {
			bn = bn2;
			cn = cn2;
			aCount = aCount2;
		}
		
		for (int i = 0; i < bn; i++) {
			bw.write(b);
		}
		
		for (int i = 0; i < cn; i++) {
			bw.write(c);
		}
		
		for (int i = 0; i < aCount.length; i++) {
			for (int j = 0; j < aCount[i]; j++) {
				bw.write(i+'a');
			}
		}
		
		bw.close();
	}

	public static void main(String[] args) throws IOException {
		new ZgukistringZ();

	}

}
