#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200009;
char a[MaxN], b[MaxN], c[MaxN], k[MaxN];
vector<int> cnta, cntb, cntc;
int main() {
  cnta.resize(30);
  cntb.resize(30);
  cntc.resize(30);
  gets(a);
  gets(b);
  gets(c);
  int alen = strlen(a);
  int blen = strlen(b);
  int clen = strlen(c);
  for (int i = 0; i < alen; i++) {
    cnta[a[i] - 'a']++;
  }
  for (int i = 0; i < blen; i++) {
    cntb[b[i] - 'a']++;
  }
  for (int i = 0; i < clen; i++) {
    cntc[c[i] - 'a']++;
  }
  string bstr = b, cstr = c;
  string ans;
  while (true) {
    int bm = INT_MAX, cm = INT_MAX;
    for (int i = 0; i < 26; i++) {
      if (cntb[i] != 0) bm = min(cnta[i] / cntb[i], bm);
      if (cntc[i] != 0) cm = min(cnta[i] / cntc[i], cm);
    }
    if (bm <= 0 && cm <= 0) break;
    if (bm >= cm) {
      ans += bstr;
      for (int i = 0; i < 26; i++) {
        cnta[i] -= cntb[i];
      }
    } else {
      ans += cstr;
      for (int i = 0; i < 26; i++) {
        cnta[i] -= cntc[i];
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < cnta[i]; j++) ans += 'a' + i;
  }
  cout << ans << endl;
}
