#include <bits/stdc++.h>
using namespace std;
long long cnta[333];
long long cntb[333];
long long cntc[333];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string a, b, c;
  cin >> a >> b >> c;
  for (auto x : a) {
    cnta[x]++;
  }
  for (auto x : b) {
    cntb[x]++;
  }
  for (auto x : c) {
    cntc[x]++;
  }
  int n = a.size();
  pair<int, int> ans = {0, 0};
  for (int i = 0; i <= n; i++) {
    int j = n;
    for (int z = 'a'; z <= 'z'; z++) {
      long long v = (cnta[z] - i * cntb[z]);
      if (v < 0) {
        j = -1;
        break;
      }
      if (cntc[z] == 0) continue;
      j = min(v / cntc[z], (long long)j);
    }
    if (j < 0) break;
    ans = max(ans, {i + j, j});
  }
  ans.first -= ans.second;
  for (int i = 0; i < ans.first; i++) {
    cout << b;
    for (auto x : b) {
      cnta[x]--;
    }
  }
  for (int i = 0; i < ans.second; i++) {
    cout << c;
    for (auto x : c) {
      cnta[x]--;
    }
  }
  for (int i = 'a'; i <= 'z'; i++) {
    for (int j = 0; j < cnta[i]; j++) {
      cout << (char)i;
    }
  }
  cout << endl;
  return 0;
}
