#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::deque;
using std::endl;
using std::map;
using std::max;
using std::min;
using std::multiset;
using std::pair;
using std::queue;
using std::set;
using std::sort;
using std::stack;
using std::string;
using std::vector;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  int dataA[26] = {
      0,
  };
  int dataB[26] = {
      0,
  };
  int dataC[26] = {
      0,
  };
  for (int i = 0; i < a.size(); i++) {
    dataA[a[i] - 'a']++;
  }
  for (int i = 0; i < b.size(); i++) {
    dataB[b[i] - 'a']++;
  }
  for (int i = 0; i < c.size(); i++) {
    dataC[c[i] - 'a']++;
  }
  int cntB = 0;
  int cntC = 0;
  for (int cnt = 0; cnt <= 100000; cnt++) {
    int tempA[26];
    for (int i = 0; i < 26; i++) {
      tempA[i] = dataA[i];
    }
    int flag = 1;
    for (int i = 0; i < 26; i++) {
      long long t = (long long)tempA[i] - (long long)cnt * dataB[i];
      tempA[i] -= cnt * dataB[i];
      if (t < 0) {
        flag = 0;
      }
    }
    if (flag == 0) {
      break;
    }
    int x = 1000000;
    for (int i = 0; i < 26; i++) {
      if (dataC[i] == 0) continue;
      x = max(0, min(x, tempA[i] / dataC[i]));
    }
    if (cnt + x > cntB + cntC) {
      cntB = cnt;
      cntC = x;
    }
  }
  for (int i = 0; i < 26; i++) {
    dataA[i] -= cntB * dataB[i];
    dataA[i] -= cntC * dataC[i];
  }
  for (int i = 0; i < cntB; i++) {
    cout << b;
  }
  for (int i = 0; i < cntC; i++) {
    cout << c;
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < dataA[i]; j++) printf("%c", i + 'a');
  }
  return 0;
}
