#include <bits/stdc++.h>
using namespace std;
char a[100005] = {}, b[100005] = {}, c[100005] = {};
int main() {
  ios::sync_with_stdio(false);
  cin >> a >> b >> c;
  int la(strlen(a)), lb(strlen(b)), lc(strlen(c)), ia[30]{}, ib[30]{}, ic[30]{};
  for (int i = 0; i < la; ++i) ++ia[a[i] - 'a'];
  for (int i = 0; i < lb; ++i) ++ib[b[i] - 'a'];
  for (int i = 0; i < lc; ++i) ++ic[c[i] - 'a'];
  int maxNb(INT_MAX);
  for (int i = 0; i < 26; ++i)
    if (ib[i] != 0) maxNb = min(maxNb, ia[i] / ib[i]);
  int nia[30], maxData[2] = {};
  for (int i = 0; i <= maxNb; ++i) {
    memcpy(nia, ia, 26 * sizeof(int));
    for (int j = 0; j < 26; ++j) nia[j] -= ib[j] * i;
    int maxNc(INT_MAX);
    for (int j = 0; j < 26; ++j)
      if (ic[j] != 0) maxNc = min(maxNc, nia[j] / ic[j]);
    if (i + maxNc > maxData[0] + maxData[1]) {
      maxData[0] = i;
      maxData[1] = maxNc;
    }
  }
  for (int i = 0; i < 26; ++i) ia[i] -= ib[i] * maxData[0] + ic[i] * maxData[1];
  for (int i = 0; i < maxData[0]; ++i) cout << b;
  for (int i = 0; i < maxData[1]; ++i) cout << c;
  for (int i = 0; i < 26; ++i) {
    for (int j = 0; j < ia[i]; ++j) cout << (char)(i + 'a');
  }
  cout << endl;
}
