#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e5 + 1;
string a, b, c;
int n, mxa, mxb;
int ac[27], bc[27], cc[27], ec[27];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> a >> b >> c;
  for (long long i = 0; i <= (long long)a.size() - 1; i++) ac[a[i] - 'a']++;
  for (long long i = 0; i <= (long long)b.size() - 1; i++) bc[b[i] - 'a']++;
  for (long long i = 0; i <= (long long)c.size() - 1; i++) cc[c[i] - 'a']++;
  mxa = 0, mxb = 0;
  for (long long i = 0; i <= INF; i++) {
    bool f = false;
    for (long long j = 0; j <= 26; j++) {
      ec[j] = ac[j] - i * bc[j];
      if (ec[j] < 0) {
        f = true;
        break;
      }
    }
    if (f) break;
    int k = INF;
    for (long long j = 0; j <= 26; j++) {
      if (cc[j] == 0) continue;
      k = min(k, ec[j] / cc[j]);
    }
    if (i + k > mxa + mxb) mxa = i, mxb = k;
  }
  for (long long j = 0; j <= 26; j++) {
    ec[j] = ac[j] - mxa * bc[j] - mxb * cc[j];
  }
  for (long long i = 1; i <= mxa; i++) {
    cout << b;
  }
  for (long long i = 1; i <= mxb; i++) {
    cout << c;
  }
  for (long long j = 0; j <= 26; j++) {
    while (ec[j] > 0) {
      cout << char('a' + j);
      ec[j]--;
    }
  }
  return 0;
}
