#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int getint() {
  int t = 0, flag = 1;
  char c = getchar();
  while (c < '0' || c > '9' || c == '-') {
    if (c == '-') flag = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') t = t * 10 + c - '0', c = getchar();
  return t * flag;
}
int GCD(int m, int n) { return !m ? n : GCD(n % m, m); }
template <typename T>
string to_string(T value) {
  ostringstream os;
  os << value;
  return os.str();
}
long long MultMod(long long a, long long b, long long MOD) {
  a %= MOD;
  b %= MOD;
  long long ret = 0;
  while (b) {
    if (b & 1) {
      ret += a;
      if (ret >= MOD) ret -= MOD;
    }
    a = a << 1;
    if (a >= MOD) a -= MOD;
    b = b >> 1;
  }
  return ret;
}
long long n, t, m;
string a, b, c;
long long ac[27], bc[27], cc[27];
int main() {
  while (cin >> a >> b >> c) {
    memset(ac, 0, sizeof ac);
    memset(bc, 0, sizeof bc);
    memset(cc, 0, sizeof cc);
    for (auto e : a) ac[e - 'a']++;
    for (auto e : b) bc[e - 'a']++;
    for (auto e : c) cc[e - 'a']++;
    long long maxans = 0, maxi = 0, maxci = 0;
    for (long long i = 100000; i >= 0; i--) {
      bool sat = 1;
      for (long long j = 0; j < 26; j++)
        if (bc[j] * i > ac[j]) {
          sat = 0;
          break;
        }
      if (!sat) continue;
      long long ci = INT_MAX;
      for (long long j = 0; j < 26; j++) {
        if (!cc[j]) continue;
        ci = min((ac[j] - i * bc[j]) / cc[j], ci);
      }
      if (i + ci > maxans) {
        maxans = i + ci;
        maxi = i;
        maxci = ci;
      }
    }
    for (long long i = 0; i < maxi; i++) cout << b;
    for (long long i = 0; i < maxci; i++) cout << c;
    for (long long i = 0; i < 26; i++) {
      ac[i] -= ((long long)maxi * bc[i] + (long long)maxci * cc[i]);
    }
    for (long long i = 0; i < 26; i++) {
      for (long long j = 0; j < ac[i]; j++) cout << char(i + 'a');
    }
    cout << endl;
  }
  return 0;
}
