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

/**
 * @problem http://codeforces.com/problemset/problem/551/B
 * @status 
 */
import java.io.*;
import java.util.*;

public class B {

	final int N = 26;

	String a, b, c;
	int w[], u[], v[];

	int n, m;

	void in() {
		a = in.nextLine();
		b = in.nextLine();
		c = in.nextLine();
	}

	int[] buildCountChars(String s) {
		int n[] = new int[N];
		Arrays.fill(n, 0);
		for (char c : s.toCharArray()) {
			n[c - 'a'] ++;
		}
		return n;
	}

	void buildWUV() {
		w = buildCountChars(a);
		u = buildCountChars(b);
		v = buildCountChars(c);
	}

	void searchNM() {
		n = 0;
		m = 0;
		for (int i = 0; i <= a.length() / b.length(); ++ i) {
			// w[k] - i*u[k] - j*v[k] >= 0

			boolean checkI = true;
			for (int k = 0; k < N; ++ k) {
				if (w[k] < i * u[k]) {
					checkI = false;
					break;
				}
			}
			if (!checkI) {
				continue;
			}

			// j <= (w[k] - i*u[k]) / v[k]

			int j = a.length() / c.length();
			for (int k = 0; k < N; ++ k) {
				if (v[k] == 0) {
					continue;
				}
				j = Math.min(j, (w[k] - i * u[k]) / v[k]);
			}

			// save max (n + m)

			if (i + j > n + m) {
				n = i;
				m = j;
			}
		}
	}

	void out() {
		int k = 0;
		for (int i = 0; i < n; ++ i) {
			out(b);
		}
		for (int i = 0; i < m; ++ i) {
			out(c);
		}
		for (int i = 0; i < N; ++ i) {
			int wi = w[i] - n * u[i] - m * v[i];
			char ch = (char)('a' + i);
			for (int j = 0; j < wi; ++ j) {
				out(ch);
			}
		}
	}

	void main() {
		in();
		
		buildWUV();

		searchNM();

		out();
	}

	Scanner in = new Scanner(System.in);
    public static void main(String[] args) { new B().main(); }
    static void out(Object s) { System.out.print(s + ""); }
    static void outln(Object s) { System.out.println(s + ""); }

}