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;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

	
  static BufferedReader in;
  static PrintWriter out;
  static StringTokenizer tok;
  static void solve() throws Exception {
	  
	  char a [] = nextLine().toCharArray();
	  char b [] = nextLine().toCharArray();
	  char c [] = nextLine().toCharArray();
	  
	  int [] k = new int[100];
	  int [] k1 = new int[100];
	  int [] k2 = new int[100];
	  
	  for(int i = 0; i < a.length ; i++) {
		  k[a[i] - 'a']++;
	  }
	  for(int i = 0; i < b.length ; i++) {
		  k1[b[i] - 'a']++;
	  }
	  for(int i = 0; i < c.length ; i++) {
		  k2[c[i] - 'a']++;
	  }
	  int m1= 0;
	  int m2 = 0;
	  mainfor:
	  for(int i = 0 ; ; i++) {
		  int d = 20000000;
		  for(int j = 0 ; j < 16; j++) {
			  if(k1[j] * i > k[j]) {
				  break mainfor;
			  }
			  if(k2[j] !=0 ) d = Math.min(d,( k[j]-k1[j]*1)/k2[j]);
		  }
		  if(i+d > m1+m2) {
			  m1 = i;
			  m2 = d;
		  }
	  }
	  
	  for(int i = 0; i < m1 ; i++) {
		  out.print(new String(b));
		  for(int j = 0; j < 26 ; j++) {
			  k[j] -= k1[j];
		  }
	  }
	  for(int i = 0; i < m2 ; i++) {
		  out.print(new String(c));
		  for(int j = 0; j < 26 ; j++) {
			  k[j] -= k2[j];
		  }
	  }
	  
	  for(int i = 0; i < 26 ; i++) {
		  for(int j = 0; j < k[i] ; j++) {
			  out.print((char)(i+'a'));
		  }
	  }
  }
  
  
  static int remove(String s) {
	  if(s.length() ==0)
		  return 0;
	  boolean found = false;
	  int index = 0;
	  for(int i = 0 ; i < s.length()-1 ; i++) {
		  if(s.charAt(i) =='0' && s.charAt(i+1) =='1') {
			  found = true;
		  }
		  if(s.charAt(i) =='1' && s.charAt(i+1) =='0') {
			  found = true;
		  }
		  if(found) {
			  index = i;
			  break;
		  }
	  }
	  if(!found)
		  return s.length();
	  
	  if(found && s.length() == 2)
		  return 0;
	  return remove(s.substring(0, index)+s.substring(index+2, s.length()));
	  
  }
  
  static void taste(int t[], int c[], int i, int j) {
	  
  }
  
  static String findDist(int r1, int c1, int n, int m, String []cave, int r2, int c2, String [][] mem) {
	  
	  if(r1 >=n || c1>=m || r1 <0 || c1 <0)
		  return "";
	  
	  if(cave[n].charAt(m) == 'X') 
		  return "";
	  
	  String value = "";
	  
	  if(r1 == r2 && c1 == c2) {
		  value = "YES";
		  return value;

	  }
	  
	  if(cave[n].charAt(m) == '.') 
		  return ".";

	  
	  String value1  = findDist(r1+1, c1, n,m, cave, r2, c2, mem);
	  String value2  = findDist(r1, c1+1, n,m, cave, r2, c2, mem);
	  String value3  = findDist(r1-1, c1, n,m, cave, r2, c2, mem);
	  String value4  = findDist(r1, c1-1, n,m, cave, r2, c2, mem);
	  
	  

	  return value;
  }

  public static void main(String args[]) {
    try {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(new OutputStreamWriter(System.out));
      solve();
      in.close();
      out.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(next());
  }

  static int[] nextIntArray(int len, int start) throws IOException {
    int[] a = new int[len];
    for (int i = start; i < len; i++)
      a[i] = nextInt();
    return a;
  }

  static long nextLong() throws IOException {
    return Long.parseLong(next());
  }

  static long[] nextLongArray(int len, int start) throws IOException {
    long[] a = new long[len];
    for (int i = start; i < len; i++)
      a[i] = nextLong();
    return a;
  }

  static double nextDouble() throws IOException {
    return Double.parseDouble(next());
  }

  static double[] nextDoubleArray(int len, int start) throws IOException {
    double[] a = new double[len];
    for (int i = start; i < len; i++)
      a[i] = nextDouble();
    return a;
  }

  static BigInteger nextBigInteger() throws IOException {
    return new BigInteger(next());
  }

  static String next() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      tok = new StringTokenizer(in.readLine());
    }
    return tok.nextToken();
  }

  static String nextLine() throws IOException {
    tok = new StringTokenizer("");
    return in.readLine();
  }

  static void shuffleArray(long[] array) {
    Random random = new Random();
    for (int i = array.length - 1; i > 0; i--) {
      int index = random.nextInt(i + 1);
      long temp = array[index];
      array[index] = array[i];
      array[i] = temp;
    }
  }

  static boolean hasNext() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      String s = in.readLine();
      if (s == null) {
        return false;
      }
      tok = new StringTokenizer(s);
    }
    return true;
  }
  
  public static int[] readIntArray(int size) throws IOException {
      int[] result = new int[(int) size];
      for (int i = 0; i < size; i++) {
          result[(int) i] = (int)nextInt();
      }
      return result;
  }

}