#include <bits/stdc++.h>
using namespace std;
int ach[130], bch[130], cch[130];
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  memset(ach, 0, sizeof(ach));
  memset(bch, 0, sizeof(bch));
  memset(cch, 0, sizeof(cch));
  int len = a.size();
  for (int i = 0; i < len; i++) ach[a[i]]++;
  len = b.size();
  for (int i = 0; i < len; i++) bch[b[i]]++;
  len = c.size();
  for (int i = 0; i < len; i++) cch[c[i]]++;
  int k = 0, ans = 0, ansk = 0;
  bool p = 1;
  while (p) {
    int l = 0x3f3f3f3f;
    for (int i = 'a'; i <= 'z'; i++) {
      if (ach[i] - k * bch[i] < 0) {
        p = 0;
        break;
      }
      if (cch[i] && l > k + (ach[i] - k * bch[i]) / cch[i])
        l = k + (ach[i] - k * bch[i]) / cch[i];
    }
    if (p && l > ans) {
      ans = l;
      ansk = k;
    }
    k++;
  }
  for (int i = 0; i < ansk; i++) cout << b;
  for (int i = 0; i < ans - ansk; i++) cout << c;
  for (int i = 'a'; i <= 'z'; i++)
    for (int j = 0; j < ach[i] - ansk * bch[i] - (ans - ansk) * cch[i]; j++)
      printf("%c", i);
  printf("\n");
  return 0;
}
