#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c, aux;
  cin >> a >> b >> c;
  int aa[26] = {0}, bb[26] = {0}, cc[26] = {0}, cntb = 0, cntc = 0,
      cntbb = 2000000;
  for (int i = 0; i < a.length(); i++) {
    aa[a[i] - 'a']++;
  }
  for (int i = 0; i < b.length(); i++) {
    bb[b[i] - 'a']++;
  }
  for (int i = 0; i < c.length(); i++) {
    cc[c[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (bb[i] != 0 && aa[i] / bb[i] < cntbb) cntbb = aa[i] / bb[i];
  }
  for (int i = 0; i <= cntbb; i++) {
    int res = 2000000;
    for (int j = 0; j < 26; j++) {
      if (cc[j] != 0 && (aa[j] - i * bb[j]) / cc[j] < res)
        res = (aa[j] - i * bb[j]) / cc[j];
    }
    if (i + res > cntc + cntb) {
      cntb = i;
      cntc = res;
    }
  }
  for (int i = 0; i < cntb; i++) cout << b;
  for (int i = 0; i < cntc; i++) cout << c;
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < aa[i] - (cntb * bb[i] + cntc * cc[i]); j++)
      cout << char(i + 'a');
  }
  cout << endl;
}
