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

#include <bits/stdc++.h>
using namespace std;
int ac[26];
int bc[26];
int cc[26];
int dc[26];
bool check(int A[], int x, int high) {
  if (x > high) return false;
  int i;
  for (i = 0; i <= 26 - 1; i++) {
    int t = cc[i] * x;
    if (t > A[i]) return false;
  }
  return true;
}
int binSearch(int A[], int up) {
  int low = 0;
  int high = up;
  int mid;
  while (low <= high) {
    mid = low + (high - low) / 2;
    if (check(A, mid, high)) {
      if (check(A, mid + 1, high))
        low = mid + 1;
      else
        return mid;
    } else
      high = mid - 1;
  }
  assert(false);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  string a, b, c;
  cin >> a >> b >> c;
  int n = a.size();
  int i;
  memset(ac, 0, sizeof(ac));
  memset(bc, 0, sizeof(bc));
  memset(cc, 0, sizeof(cc));
  for (i = 0; i <= n - 1; i++) {
    ac[a[i] - 'a']++;
  }
  n = b.size();
  for (i = 0; i <= n - 1; i++) {
    bc[b[i] - 'a']++;
  }
  n = c.size();
  for (i = 0; i <= n - 1; i++) {
    cc[c[i] - 'a']++;
  }
  int x, y;
  int mx, my;
  mx = std::numeric_limits<int>::max();
  for (i = 0; i <= 26 - 1; i++) {
    if (bc[i] == 0) continue;
    if (ac[i] / bc[i] < mx) mx = ac[i] / bc[i];
  }
  my = std::numeric_limits<int>::max();
  for (i = 0; i <= 26 - 1; i++) {
    if (cc[i] == 0) continue;
    if (ac[i] / cc[i] < my) my = ac[i] / cc[i];
  }
  int j;
  int ans = std::numeric_limits<int>::min();
  n = a.size();
  for (i = 0; i <= n - 1; i++) dc[i] = ac[i];
  int ax, ay;
  int k;
  for (i = 0; i <= mx; i++) {
    j = binSearch(dc, my);
    if (i + j > ans) {
      ans = i + j;
      ax = i;
      ay = j;
    }
    for (k = 0; k <= 26 - 1; k++) dc[k] -= bc[k];
  }
  for (i = 1; i <= ax; i++) cout << b;
  for (i = 1; i <= ay; i++) cout << c;
  for (i = 0; i <= 26 - 1; i++) ac[i] -= ax * bc[i] + ay * cc[i];
  for (i = 0; i <= 26 - 1; i++) {
    for (j = 1; j <= ac[i]; j++) cout << (char(i + 'a'));
  }
  return 0;
}
