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;
template <typename T>
void nexts(T *, int);
template <typename T>
void dump(T *arr, int cnt, char sep = ' ');
void __init__(bool, bool);
const int MAXMAXMAX = 1000 * 1000 * 1000;
string a, b, c;
char ans[100015];
vector<int> cnt_a(26);
vector<int> cnt_b(26);
vector<int> cnt_c(26);
int main() {
  __init__(1, 0);
  cin >> a >> b >> c;
  for (int(i) = (0); (i) < (a.size()); ++(i)) ++cnt_a[a[i] - 'a'];
  for (int(i) = (0); (i) < (b.size()); ++(i)) ++cnt_b[b[i] - 'a'];
  for (int(i) = (0); (i) < (c.size()); ++(i)) ++cnt_c[c[i] - 'a'];
  int b_max = MAXMAXMAX;
  for (int(i) = (0); (i) < (26); ++(i))
    if (cnt_b[i] != 0) b_max = min(b_max, cnt_a[i] / cnt_b[i]);
  int max_ans = 0;
  int max_b = 0;
  int max_c = 0;
  if (b_max == MAXMAXMAX) b_max = 0;
  vector<int> tmp = cnt_a;
  for (int(i) = (0); (i) < (b_max + 1); ++(i)) {
    if (i != 0)
      for (int(i) = (0); (i) < (26); ++(i)) tmp[i] -= cnt_b[i];
    int c_max = MAXMAXMAX;
    for (int(i) = (0); (i) < (26); ++(i))
      if (cnt_c[i] != 0) c_max = min(c_max, tmp[i] / cnt_c[i]);
    if (c_max == MAXMAXMAX) b_max = 0;
    if (i + c_max > max_ans) {
      max_ans = i + c_max;
      max_b = i;
      max_c = c_max;
    }
  }
  for (int(i) = (0); (i) < (max_b); ++(i)) cout << b;
  for (int(i) = (0); (i) < (max_c); ++(i)) cout << c;
  for (int(i) = (0); (i) < (26); ++(i)) {
    cnt_a[i] -= max_b * cnt_b[i] + max_c * cnt_c[i];
    for (int(j) = (0); (j) < (cnt_a[i]); ++(j)) cout << (char)('a' + i);
  }
  cout << '\n';
  return 0;
}
template <typename T>
void nexts(T *arr, int cnt) {
  for (int i = 0; i < cnt; ++i) cin >> arr[i];
}
template <typename T>
void dump(T *arr, int cnt, char sep) {
  for (int i = 0; i < cnt; ++i) cout << arr[i] << sep;
}
void __init__(bool fastIOstream, bool acmp) {
  if (fastIOstream) {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
  }
  if (acmp) {
    freopen("INPUT.TXT", "rt", stdin);
    freopen("OUTPUT.TXT", "wt", stdout);
  }
}
