#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int m, long long int n) {
  if (n == 0) return m;
  return gcd(n, m % n);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string a, b, c;
  cin >> a;
  cin >> b;
  cin >> c;
  int arr[26] = {0};
  int barr[26] = {0};
  int carr[26] = {0};
  for (int i = 0; i < (int)(a.size()); i++) arr[a[i] - 'a']++;
  for (int i = 0; i < (int)(b.size()); i++) barr[b[i] - 'a']++;
  for (int i = 0; i < (int)(c.size()); i++) carr[c[i] - 'a']++;
  char f[100010];
  int k = 0;
  while (1) {
    int fl1 = 0;
    int fl2 = 0;
    int bmin = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (arr[i] < barr[i]) {
        fl1 = 1;
        break;
      }
      if (arr[i] != 0 && barr[i] != 0) {
        bmin = min(bmin, arr[i] / barr[i]);
      }
    }
    int cmin = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (arr[i] < carr[i]) {
        fl2 = 1;
        break;
      }
      if (arr[i] != 0 && carr[i] != 0) {
        cmin = min(cmin, arr[i] / carr[i]);
      }
    }
    if (fl1 == 1 && fl2 == 1)
      break;
    else if (fl1 == 1) {
      for (int j = 0; j < (int)(c.size()); j++) {
        f[k] = c[j];
        k++;
        arr[c[j] - 'a']--;
      }
    } else if (fl2 == 1) {
      for (int j = 0; j < (int)(b.size()); j++) {
        f[k] = b[j];
        k++;
        arr[b[j] - 'a']--;
      }
    } else {
      if (cmin >= bmin) {
        for (int j = 0; j < (int)(c.size()); j++) {
          f[k] = c[j];
          k++;
          arr[c[j] - 'a']--;
        }
      } else {
        for (int j = 0; j < (int)(b.size()); j++) {
          f[k] = b[j];
          k++;
          arr[b[j] - 'a']--;
        }
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    while (arr[i] > 0) {
      f[k] = 97 + i;
      k++;
      arr[i]--;
    }
  }
  for (int i = 0; i < (int)(a.size()); i++) cout << f[i];
  cout << endl;
  return 0;
}
